-
-
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
Coverage incomplete using projects
#5457
Comments
Hey @robdonn
Although I have matched versions of node, yarn, and even MacOs High Sierra I could not recreate it. |
i have this same problem too and its been driving me nuts. possibly something to do with multiple packages that depend on each other using lerna? hmmm not sure |
Possibly related to #6506 |
Still seeing this issue on latest, seems like repeated runs will eventually pick up the projects for me. |
Can someone set up a good reproduction case for this? |
@SimenB minimal test case is available in #6506. https://github.com/DrewML/jest-coverage-bug-repro |
Same issue. It's driving me crazy. We have to depreciate the jest |
@nerdmax I'm sure that's not optimal but running all the tests in parallel by passing |
@nrobertdehault Thank you for your reply. I tried |
For what it's worth, we've had the same problem for a good while, but since we've been using the fix in istanbuljs/babel-plugin-istanbul#171, we're getting coverage on all of our projects in a multi-project Jest... uhm... project. :) As described in the PR above, I believe this is the cause of several multi-project coverage related issues: this one, #5417 and #6483. Give it a shot! |
That's awesome @jure! |
Had similar issue with missing coverage in CI. Managed to locally repro this by running jest with |
Got bitten by this recently as my test file count grows. The key to reproduce is to have many test files, far exceeding the default number of test workers. All sample repro to similar issues to this have number of test files less than my cpu core, so I can't reproduce the issue (coverage generated correctly) with it. My project has 23 test files across 5 sub-projects, running with default worker, the coverage is incomplete like this issue described. But running
|
@panjiesw If you're using yarn, can you try using resolutions to do something like
The above uses the code from istanbuljs/babel-plugin-istanbul#171, but compiled to |
@jure I'm not using yarn. Is there any similar way using npm to resolve @SimenB are you still looking for good repro for this issue? There is one linked to this issue, if the author don't mind , which I have tried and also suffer from this issue: https://github.com/magento-research/pwa-studio |
@panjiesw For a simple one-off test, you could find the |
@jure got it working using your suggested solution. Can confirm now the coverage generated correctly, it works! Now we wait until it's released and jest using the new |
Jest uses v5 of |
Just a heads up, the |
@DrewML your reproduction is fixed in Jest 24 (using $ npx jest --version
24.0.0-alpha.12
$ npm run test:ohno
> jest-coverage-bug-repro@1.0.0 test:ohno /Users/simen/Development/jest-coverage-bug-repro
> jest --no-cache -i
PASS Project 1 packages/project1/index.spec.js
PASS Project 2 packages/project2/index.spec.js
-----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-----------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
project1 | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
project2 | 100 | 100 | 100 | 100 | |
index.js | 100 | 100 | 100 | 100 | |
-----------|----------|----------|----------|----------|-------------------|
Test Suites: 2 passed, 2 total
Tests: 3 passed, 3 total
Snapshots: 0 total
Time: 3.728s
Ran all test suites in 2 projects. Gonna close, trying to find a reproduction to test the fix in |
Awesome - thanks @SimenB! Much appreciated. |
Adding these two configs will work for me.
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can
yarn install
andyarn test
.Sample repo
What is the expected behavior?
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
Jest configurations are available in the sample repo. There is a configuration in the root of the repository and configurations also in each project folder for more project-specific stuff.
All coverage configuration is done at root as globalConfig as recommended in #4255
MacOS High Sierra - 10.13.3
node - v9.3.0
yarn -v 1.3.2
The text was updated successfully, but these errors were encountered: