Gathering detailed insights and metrics for nock-puppeteer
Gathering detailed insights and metrics for nock-puppeteer
Gathering detailed insights and metrics for nock-puppeteer
Gathering detailed insights and metrics for nock-puppeteer
npm install nock-puppeteer
Typescript
Module System
Node Version
NPM Version
68.2
Supply Chain
78.3
Quality
75.6
Maintenance
100
Vulnerability
100
License
TypeScript (87.55%)
HTML (12.45%)
Total Downloads
155,220
Last Day
10
Last Week
306
Last Month
1,531
Last Year
27,393
7 Stars
61 Commits
4 Forks
1 Watchers
5 Branches
3 Contributors
Updated on Apr 07, 2024
Minified
Minified + Gzipped
Latest Version
14.4.1
Package Id
nock-puppeteer@14.4.1
Unpacked Size
5.51 kB
Size
2.26 kB
File Count
4
NPM Version
8.9.0
Node Version
18.2.0
Cumulative downloads
Total Downloads
Last Day
900%
10
Compared to previous day
Last Week
24.9%
306
Compared to previous week
Last Month
-12.4%
1,531
Compared to previous month
Last Year
-15.4%
27,393
Compared to previous year
Integration/E2E tests and scrapers need to mock puppeteer's browser http requests
why not to have the abilities of Nock.js?
"Nock works by overriding Node's http.request function" and when you run tests/scrapers with puppeteer the browser make the http requests
nock-puppeteer simply execute the requests within the test/scraper itself instead of the browser with the help of puppeteer setRequestInterceptor hook.
This package will execute the requests from the node process and will return the mock response (if exist) as a response to the browser
1const puppeteer = require('puppeteer'); 2const nock = require('nock'); 3const useNock = require('nock-puppeteer'); 4 5(async () => { 6 const browser = await puppeteer.launch(); 7 const page = await browser.newPage(); 8 useNock(page, ['https://example.com/api']) 9 10 const getProducts = await nock('https://example.com/api') 11 .get('/api/products') 12 .reply(200, [{id: 1, product: 'A'}, {id: 2, product: 'B'}]); 13 14 await page.goto('https://example.com'); 15 await page.screenshot({path: 'example.png'}); 16 await browser.close(); 17})();
page
- puppeteer page instance
allowedHosts
- array of hosts that you want to mock. every request from the browser that include those strings will execute by the node process
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 1/5 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More