Support maxWorkers or runInBand when using 'projects'
See original GitHub issue🐛 Bug Report
When defining multiple projects via the projects
config option, where one project has maxWorkers
set (ie. 1), that setting is not respected.
In the case of a mono-repo, assume we have two projects. One which runs parallel, and another which needs to be run sequentially. For this, the latter has the config setting maxWorkers: 1
.
When we run jest from the base config, however, the latter runs in parallel, ignoring the maxWorkers: 1
setting.
To Reproduce
- Setup a mono-repo with two jest config files
- Set one to
maxWorkers: 1
- Add both config paths to base
projects
property - Run jest
Expected behavior / Proposal
I propose the following:
- Determine global max workers as:
- (If present)
maxWorkers
setting in base config - (Otherwise) Determine the maximum value specified for
maxWorkers
found in all projects config files
- (If present)
- Allow each project to use
- (If present) Its own
maxWorkers
# of workers - (Otherwise) The global maximum # of workers
- (If present) Its own
Effectively, this ensures that maxWorkers
behaviour matches that of running jest on an individual project.
envinfo
System:
OS: Windows 10 10.0.19041
CPU: (4) x64 Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
Binaries:
Node: 14.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: ^26.5.3 => 26.6.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:19
- Comments:14
Top Results From Across the Web
Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >Jest: Difference betwen --runInBand and --maxWorkers 1
I'm using Jest to test a NodeJs express application, with integration tests hitting the HTTP endpoints via supertest . This may not make...
Read more >Troubleshooting · Jest
Note: Debugging support with Jest only supports node debug ; it does yet ... statement in any of your tests, and then, in...
Read more >How to make your sluggish Jest tests go faster - ITNEXT
Here's our original project's setup: React v16.5; Typescript v3.1; Jest v23.6 using jsdom as testEnvironment; ts-jest; Win10.
Read more >Jest CLI Options - API Manual
Generate a basic configuration file. Based on your project, Jest will ask you a few questions that will help to generate a jest.config.js...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thymikee Is it possible someone could take a look at the PR for this? It may have been buried as it was first opened a year ago
Finally updated my PR to implement this. Would be great to get a review 😃