You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, when set collectCoverage to true, jest-playwright can collect the code coverage information from babel-plugin-istanbul and output the coverage to .nyc_output. Since Jest can already output the coverage, it's better to merge the coverage into the Jest itself so that users can see the code coverage both from unit tests and e2e tests in one place.
$ yarn run test
PASS test/primeDeco.test.js <--- a jest unit test
PASS test/fibonacci.test.js <--- a jest-playwright e2e test
Test Suites: 2 passed, 2 total
Tests: 7 passed, 7 total
Snapshots: 0 total
Time: 4.718s
Ran all test suites.
--------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
--------------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
fibonacci.js | 100 | 100 | 100 | 100 | | <--- coverage by jest-playwright e2e test
primeDeco.js | 100 | 100 | 100 | 100 | | <--- coverage by jest unit test
--------------|----------|----------|----------|----------|-------------------|
Describe the solution you'd like
Create a jest reporter to inject the coverage information from window.__coverage__ to Jest context. This reporter will use istanbul-lib-coverage to merge the coverage information from two sources.
Describe alternatives you've considered
N/A
Additional context
I've developed something very similar for jest-puppeteer: jest-puppeteer-istanbul. I would like to add this feature to jest-playwright if you guys think it's a good idea. By adding this feature to this repo instead of creating a separate package, users can skip the complex setup steps and let jest-playwright-preset do the work for them.
The text was updated successfully, but these errors were encountered:
@ocavue thanks for your suggestion. I think that can be helpful feature, but only thing that i want is to give developer ability to control this reporter. So it will be nice if it'll be configurable
@mmarkelov Thank you for your response. We can add a new configuration field coverageOutput to JestPlaywrightConfig, which controls how the coverage collection output.
exportinterfaceJestPlaywrightConfig{/** * The coverage output format. If includes `'files'`, save the coverage collection * to the `.nyc_output/coverage.json` file. If includes `'jest'`, save the coverage * collection as part of Jest's coverage output. * * @default ['files'] */coverageOutput?: Array<'file'|'jest'>}
I don't know which definition is better: coverageOutput?: Array<'file' | 'jest'> or coverageOutput?: 'file' | 'jest' | 'all'. Do you have any suggestion?
Is your feature request related to a problem? Please describe.
Currently, when set
collectCoverage
totrue
,jest-playwright
can collect the code coverage information frombabel-plugin-istanbul
and output the coverage to.nyc_output
. Since Jest can already output the coverage, it's better to merge the coverage into the Jest itself so that users can see the code coverage both from unit tests and e2e tests in one place.Describe the solution you'd like
Create a jest reporter to inject the coverage information from
window.__coverage__
to Jest context. This reporter will use istanbul-lib-coverage to merge the coverage information from two sources.Describe alternatives you've considered
N/A
Additional context
I've developed something very similar for jest-puppeteer: jest-puppeteer-istanbul. I would like to add this feature to jest-playwright if you guys think it's a good idea. By adding this feature to this repo instead of creating a separate package, users can skip the complex setup steps and let
jest-playwright-preset
do the work for them.The text was updated successfully, but these errors were encountered: