-
-
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
Code coverage of spawned processes #3190
Comments
unfortunately it's not possible now because that will be very very hard to implement. the coverage is generated by instrumenting the code that's being run with runtime coverage checks + exporting the results after the process is finished. This process is not generic at all, and since pretty much anything can be run as a child process, there's no possible way we can collect coverage from these processes. |
Interesting, I assumed jest used nyc for coverage and that's able to provide coverage of spawned processes. |
yeah, it's definitely possible and |
Closing this as wontfix for now, it is unlikely we'll get to this. |
I found a workaround for this:
|
@sokra nice, that's really gross but better than nothing! |
@aaronabramov see the tmp project where we use external process for integration testing. There, we use istanbul and mocha and collect the coverage data from the spawned child processes using https://github.com/raszi/node-tmp/blob/master/test/child-process.js#L40. |
Since this is still seeing some activity, this is the open issue tracking this: #5274 (we're not any closer to a solution, but that's where discussion should happen) |
I only had to run |
This will enable code coverage information to be displayed for src/cli.js. The `nyc` package will be required since `child_process` functions such as `exec` will be used for testing and `nyc` can detect code coverage for spawned processes and jest cannot at the moment, see (jestjs/jest#3190). The `esm` package will be used to load the `cli.js` module during testing since it's written using ECMAScript and that is not supported by node`child_process` executing a script.
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?
Unclear, hopefully just a bug?
What is the current behavior?
Any node.js code run via the
child_process
module doesn't display any coverage information..spawn()
vs.fork()
doesn't seem to matter.https://repl.it/G9jH/0
What is the expected behavior?
I'd like to see coverage numbers from spawned node processes assuming that they were part of the project.
The text was updated successfully, but these errors were encountered: