Jest doesn't always try to run test suites in parallel
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
Repro here: https://github.com/gsteacy/jest-bug-repro. Running npm test
is sufficient. Ignore the test failure. I’m using the same repro for multiple bugs.
The problem (assuming this is not by design) is not consistently reproducible. For the repro given, Jest runs both test suites in parallel when the cache is ignored with --no-cache
or if there is no cache available. Subsequent runs with a cache run the test suites serially.
For some larger projects I have (with more complex configurations) Jest will always run the tests in parallel unless told to do otherwise, but for other projects it won’t. I haven’t been able to find a pattern.
What is the expected behavior?
Jest runs the test suites in parallel as --runInBand
has not been specified.
Please provide your exact Jest configuration
Defaults
Run npx envinfo --preset jest
in your project directory and paste the
results here
System:
OS: Windows 8.1
CPU: x64 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
Binaries:
Node: 6.13.1
Yarn: 1.3.2
npm: 3.10.10
npmPackages:
jest:
wanted: ^22.4.2
installed: 22.4.2
I have also tried it with Node 8 and there is no apparent difference in behaviour.
System:
OS: Windows 8.1
CPU: x64 Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz
Binaries:
Node: 8.10.0
Yarn: 1.3.2
npm: 5.6.0
npmPackages:
jest:
wanted: ^22.4.2
installed: 22.4.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:10
Top GitHub Comments
Create at least 21 test files and invoke with
--maxWorkers=4
to run tests on 4 threads for example. That should be enough to trick Jest into running your tests always in parallel.Not sure whether this is a very recent regression somewhere in the stack, but I just discovered that around upgrading to 24.8.0, I had to remove
--detectOpenHandles
if I wanted tests to run in parallel. This was not the case until very recently.