stryker-js
stryker-js copied to clipboard
Initial test run `runInBand` in jest
Summary
I found out that Stryker runs jest with runInBand: true
option. And this makes initial test run very very slow for me, and it is fails with timeout error because of this. What is the reason to run tests in band?
Stryker needs it to run in band, so coverage per test can be reported back to Stryker.
During mutation testing, Stryker already runs multiple test runners in parallel, so adding more parallelism would not improve performance. In fact, it would decrease it.
Strange that you're running in a timeout. What exactly do you mean by that? Does the dry run timeout?
Ah sorry, I see you specified "initial run" in the title.
If you run into a timeout then you can use dryRunTimeoutMinutes.
How long does a normal unit test run with jest take?
Normal run: 68 s Run in band: 621s Both runs after clear cache
Also, can I bump #1655 here? :D
Sometimes, when working on tests for peace of code, I want to regularly rerun stryker to check coverage. But I can't wait 10 minutes for initial tests run each time, this is too long
I think #1655 would solve the use case where you simply want to run Stryker with Jest on a single file in a large code base. I'll add the hacktoberfest label to it. Seems to do wonders these days 😉
@nicojs if I understand correctly, runInBand
is not needed when coverageAnalysis: 'off'
, right?
@nicojs would you be open to add an optional parameter to the CLI so that one could do:
stryker run path/to/my-test.js
?
I see @Djaler's PR improves DX for a mutant check of a subset of files and I think this would be the icing on the cake.
Currently it's <command> [options] [configFile]
so we'd have to think how (or if) we can remain backwards compatible.
@Edgpaez that would be very breaking and I don't know if it would add a lot.
My guess is that you mean stryker run path/to/my-source-file-to-mutate.js
rather than my-test.js
. You can see how this might be confusing without an option flag.
Also, what you want is already supported with the option flag -m
: stryker run -m path/to/my-source-file-to-mutate.js
.
Please open a separate issue if you want to discuss it further.
@nicojs if I understand correctly,
runInBand
is not needed whencoverageAnalysis: 'off'
, right?
That would be true. If you want, you can create a PR for that case. However, I'm not a big fan. I'm thinking of removing the option to turn off coverage analysis altogether and simply always force "perTest"
. It would simplify StrykerJS's usage and inner workings a lot.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.