Open dubbha opened 4 years ago
I think ditching the coverage if tests fail makes sense. @thymikee @jeysal thoughts? We can probably get that into Jest 25
Agree with @SimenB. I don't see a value in processing coverage for a failed test and related files (if not processed by other code). By doing so, we could also end up with a slightly faster feedback loop and less clutter to scroll through when identifying failed expectation.
It seems like it is conflating very different things, coverage to me does not even require test cases that can pass or fail, it can be done on any program execution. This would also introduce an unintuitive half-coverage run where code is still run instrumented but no coverage output generated. Overall sounds like a lot of architectural complexity, not like "do one thing" / separation of concerns. I think maybe it's better to fix performance of the "Collecting coverage from untested files" step instead, which has always struck me as a problem, even on passed runs in many projects.
There is no performance issue in "Collecting coverage from untested files" (or, there is, but that's totally orthogonal to the issue reported here) - the issue here is that bail
is broken and doesn't stop other tests before reporting the run as complete, meaning we're still running tests on a bunch of cores, then spawn new workers to collect coverage on uncovered files thus bombing the CPU with (numberOfCores - 1) * 2
processes
Okay that's a nasty bug - rest still stands though I think it would be better to fix it than bailing out on coverage collection on failure.
Is there any plan to resolve this bug? Or maybe a known work around while there isn't a permanent solution?
any progress here? it will be almost two years from the last comment...
PR welcome 🙂
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.
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.
Yes, it's still a problem...
I noticed my RAM was being consumed and that my test suite seemed to be stalled while everything on my system started reported as being non-responsive. I noticed that there were a ton of node processes spawned each using 500-700MB+ of RAM. After killing the test running those processes went away and I got my RAM back.
Part of me believes that if you're asking for coverage then it shouldn't matter if a test fails, but in our scenario we would like to halt our integration process on a failed test while trying to collect coverage, but we also do not want to run the suite twice (once for tests and again for coverage). This has seemed to never work as expected, and lately we've been running into some major resource consumption that seems to be related to 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.
if you're asking for coverage then it shouldn't matter if a test fails
I have to disagree here - with bail
some tests won't run at all on failure, so why bother to collect coverage at all?
🐛 Bug Report
To Reproduce
Steps to reproduce the behavior:
--bail
and--covarage
with a failing test:If there is a single failing test jest start running coverage of untested files and pretty soon eats up all the CPU, preventing any usage of the system, e.g. mouse becomes unresponsive. And it never releases to the point I have to restart the machine, at least with Win10.
Expected behavior
I don't expect my machine to hang, obviously. Also it might make sense to bail out of the coverage on untested files in case of a bail out. BTW, is there a way to prevent --coverage in case there's a failed test and we bail out? Is there some way to configure it? If not, would that make sense as a feature? I mean, I don't really care for the coverage until I fix the failing test.
Link to repl or repo (highly encouraged)
envinfo
It kind of happens like this:
tests pass until one test fail, and then
coverage on untested files
follows, and that's where things get nasty very fast if you are not fast enough to hitCtrl+C
.