-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add One Double Zero as coverage provider #15356
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
a294926
to
6f9e982
Compare
aef6c8b
to
436bf7f
Compare
c44c4cf
to
1fe4bce
Compare
Another interesting test is using jest to check the coverage of the jest project itself, with every
$ yarn jest --coverage --coverageProvider=babel
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
All files | 68.51 | 65.55 | 65.33 | 68.54 |
Test Suites: 1 failed, 470 passed, 471 total
Tests: 1 failed, 51 skipped, 5132 passed, 5184 total
Snapshots: 1766 passed, 1766 total
Time: 96.649 s
Ran all test suites in 15 projects.
$ yarn jest --coverage --coverageProvider=v8
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
All files | 68.33 | 86.69 | 75.97 | 68.33 |
Test Suites: 1 failed, 470 passed, 471 total
Tests: 1 failed, 51 skipped, 5132 passed, 5184 total
Snapshots: 1766 passed, 1766 total
Time: 81.74 s, estimated 90 s
Ran all test suites in 15 projects.
$ yarn jest --coverage --coverageProvider=odz
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------
All files | 65.68 | 61.61 | 64.67 | 65.76 |
Test Suites: 1 failed, 470 passed, 471 total
Tests: 1 failed, 51 skipped, 5132 passed, 5184 total
Snapshots: 1766 passed, 1766 total
Time: 76.922 s, estimated 79 s
Ran all test suites in 15 projects. The most striking difference is the function and branch coverage reported by
Using The differences between About performance differences: without a proper benchmark under some controlled environment and context, and multiple executions, they don't mean much. But it is likely that |
Summary
As explained in the issue,
v8
coverage provider comes with some important tradeoffs compared to the babel/istanbul one. One Double Zero is a code coverage tool and API that consumes V8 coverage data and targets the accuracy and correctness of istanbul. It does this by operating at the AST level.This PR adds One Double Zero as a coverage provider.
It also updates the documentation, and explains the tradeoffs of the
v8
coverage provider.Test plan
The plan is to execute
odz
on each e2e test executed by thev8
coverage provider test suite, and use the output result as the snapshot fore2e/__tests__/coverageProviderODZ.test.ts
. The test script of eache2e
has to be changed to be executable wth either node or ts-node, which does not impact the coverage result.A few changes had to be made, like passing the list of files to cover to the
_getCoverageResult
method, but globally the changes required to addodz
were minimal.