Skip to content
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

Fix bug where coverage is not collected #632 #709

Closed
wants to merge 1 commit into from

Conversation

JeffRMoore
Copy link

This fixes the bug discussed in #632 where coverage is not being collected correctly when using collectCoverage.

@cyjia tracked down the cause in #632. The onlyCollectFrom variable is an object, so !onlyCollectFrom always returns false instead of the intent of testing if the collectCoverageOnlyFrom configuration option is being used.

@cpojer
Copy link
Member

cpojer commented Feb 15, 2016

Wait, this is weird. When do you get an object instead of undefined? It should only be an object when the option is explicitly provided in your config. If it isn't provided, it should be undefined.

@cpojer
Copy link
Member

cpojer commented Feb 18, 2016

Should be fixed by #599. Thanks for your contribution.

@cpojer cpojer closed this Feb 18, 2016
@JeffRMoore
Copy link
Author

I'm calling from a gulp task with...

jest.runCLI({}, __dirname, onComplete);

and

"collectCoverage": true,

In my package.json, with no collectCoverageOnlyFrom specified. The onlyCollectFrom variable then holds an empty object.

@JeffRMoore
Copy link
Author

Ah, It looks like there was code in the test runner which assigned the object value.

https://github.com/facebook/jest/blob/0.8.2/src/TestRunner.js#L249

It looks like that is gone from the current master version of TestRunner.js.

Thanks.

@cpojer
Copy link
Member

cpojer commented Feb 20, 2016

You can try jest-cli@next and see if that fixes your issue. It'll also make your test runs 2-4x faster :)

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants