-
-
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
jest coverage misses subprocesses #5274
Comments
Duplicate of #3190, but I'm fine with a tracking issue, it feels like something that should work. |
Huge bummer that the original issue and this one have languished for so long unresolved. Built-in coverage in jest was money in the bank, and was really hoping nyc's method for tracking coverage in subprocesses would've been migrated here. At present the only workaround is to use |
Help very much welcome in landing support for it 🙂 I'm not sure how |
@SimenB looks like nyc is using spawn-wrap (wrapper for your process and automatically wraps child processes), and require hooks to transform code for coverage during runtime. From what I can tell, it looks like Jest is transforming everything first, then running. So I think Jest would need to switch to the hook-based approach to achieve this |
Jest injects its own |
Hmm, maybe the only work needed is adding |
As maintainer of nyc I have to advise against using |
Any news? |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
activity |
This would be hugely helpful for functional test suites |
any news on this? |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
comment |
Using complicated workaround because of jestjs/jest#5274
Hello,
some time ago I opened an issue with
nyc
, which is a CLI interface toistanbul
, the instrumenter used byjest
#729. It is related to getting incorrect coverage out ofjest
(+nyc
) combination. I'll briefly summarize and hopefully explain why I'm also opening the issue with Jest.We use Jest as our test platform and would like to also use its
--coverage
feature. However, even after thorough testing, we weren't able to get coverage output for files executed in a forked subprocess (we spawn servers and hit them with requests to test their API). Parent files would report coverage correctly, while no coverage would be output for child files.So we introduced
nyc
to the mix. Surprisingly,nyc
would output correct coverage for the child process files, but no coverage for the parent files. Gentlemen atnyc
suggested running tests twice and merging the results, but that has proven difficult for our use case.Expected behavior
Jest should correctly output coverage for forked processes.
Observed behavior
Jest outputs no coverage for forked processes.
Repo that reproduces the issue
https://github.com/mnmkng/nyc-jest-issue
The nice gentlemen at
nyc
offered coordination in resolution of this issue, so feel free to refer back to the originalnyc
issue #729 for more details and discussion.Thank you for your time.
The text was updated successfully, but these errors were encountered: