Gathering detailed insights and metrics for jest-puppeteer-istanbul
Gathering detailed insights and metrics for jest-puppeteer-istanbul
Gathering detailed insights and metrics for jest-puppeteer-istanbul
Gathering detailed insights and metrics for jest-puppeteer-istanbul
npm install jest-puppeteer-istanbul
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
27 Stars
107 Commits
1 Forks
3 Watching
24 Branches
2 Contributors
Updated on 07 Feb 2024
TypeScript (90.15%)
JavaScript (5.65%)
Shell (4.2%)
Cumulative downloads
Total Downloads
Last day
-29.4%
125
Compared to previous day
Last week
-2.6%
700
Compared to previous week
Last month
-0.3%
3,056
Compared to previous month
Last year
32.9%
31,283
Compared to previous year
Using Playwright? Check https://github.com/ccpu/jest-playwright-istanbul, which is a fork of this project.
1yarn add -D jest-puppeteer-istanbul 2// or 3npm install -D jest-puppeteer-istanbul
Make sure that you have Jest and Babel installed and configured.
Install babel-plugin-istanbul
and add it to your Babel config.
You should ONLY use this plugin when you are in development mode. This plugin will add a lot of code for keeping track of the coverage statements. You definitely won't want them in your final production code.
Babel configuration examples:
1// .babelrc.js 2 3const plugins = [ /* Your babel plugins */ ] 4if (process.env.NODE_ENV === "development") { 5 plugins.push("istanbul") 6} 7module.exports = { 8 plugins: plugins 9}
1// babel.config.json 2 3{ 4 "plugins": [ 5 // Your babel plugins 6 ], 7 "env": { 8 "development": { 9 "plugins": [ 10 "istanbul" 11 ] 12 } 13 } 14}
Update your Jest configuration:
json
to coverageReporters
. Since the defualt value of coverageReporters
has json
inclued, you don't need to change coverageReporters
if you havn't specify it.jest-puppeteer-istanbul/lib/setup
to setupFilesAfterEnv
.jest-puppeteer-istanbul/lib/reporter
to reporters
.Notice:
If custom reporters are specified, the default Jest reporters will be overridden. To keep default reporters,
default
can be passed as a module name.
A Jest configuration example:
1{ 2 coverageReporters: ["json", "text", "lcov"], 3 setupFilesAfterEnv: ["jest-puppeteer-istanbul/lib/setup"], 4 reporters: ["default", "jest-puppeteer-istanbul/lib/reporter"], 5 collectCoverage: true, 6}
jest-puppeteer-istanbul
need to access puppeteer page from global variable page
to get coverage information. If you use jest-puppeteer, jest-puppeteer will do it for you and you can skip this step. Otherwise you need to do it yourself, like below:
1beforeAll(async () => { 2 const browser = await puppeteer.launch() 3 const page = await browser.newPage() 4 global.page = page 5}) 6describe("E2E Tests", () => { 7 test(async () => { /* Your test code */ }) 8})
Check this link for complete examples.
If you can't get the code coverage correctly when using the Jest from IntelliJ IDEA or WebStorm, that's because the IDE ignores jest-puppeteer-istanbul/lib/reporter
in the jest.config.js
in favour of its own Jest reporter. You can add --reporters jest-puppeteer-istanbul/lib/reporter
in your IDE's Jest configuration like below to fix this.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/22 approved changesets -- 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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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