-
-
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
Support maxWorkers or runInBand when using 'projects' #10936
Comments
Can you put up a minimal repro that could be downloaded? |
|
That's a good point. I can think of one other use case, but I think there may be a better proposal to cover that (detail to follow). I can see it being useful to allocate a smaller fraction of the overall worker threads in some instances. Say we have that scenario in a very large mono-repo with multiple projects. Several config files contain very long-running tests, and those particular tests hit first. In this scenario, we might want to limit the total threads for the longer running config file so that we can run our faster tests in parallel along-side of them. This way it can fail more quickly if there are problems in the shorter running tests and avoid having to run separate calls to jest to accomplish this. It's maybe not a perfect example, but it should give an idea. In that scenario, we could specify a max of 3 threads to the long running out of the global 8. However... Amended ProposalI think you're right about
minWorkersAllows configuring the minimum number of threads to be used for a particular project. (This setting would only have effect when run in projects mode) This would allow giving specific projects the ability to use more of the allotted threads while allowing elasticity when threads are free. So in our example above, we could configure This would effectively give us a 3 / 5 distribution unless the faster tests finish first, in which case the longer tests will fill up the remaining slots. |
@thymikee Did you still need this? |
Nah, we're good |
This would be amazing!! Our use case is fullstack testing for Blitz apps. We want client code tests to run in parallel but run server tests in series because they use the same test DB. |
Very similar use case here. Want to run all tests with unit tests running in parralel while integration tests run in series. |
Considering there's a super simple runner that provides this functionality: https://github.com/gabrieli/jest-serial-runner it shouldn't be too difficult to add this option to the project config. |
I share @taylorhoward92's use-case exactly. I thought I had come up with a solution (here), and indeed it does seem to work for me, but apparently I'm just getting lucky :). |
I've got a draft PR for this, thought it'll need updating: #10912 |
runInBand at the project level is definitely a very welcome compromise. I've just moved a monorepo project to use Jest's |
Finally updated my PR to implement this. Would be great to get a review :) |
@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 |
how about all cli options? seems ridiculous that this is not all configurable. why is maxWorkers in the config documentation but doesn't work? |
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. |
Not stale. There's an open PR for 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. |
Not stale. |
FYI I've closed my PR related to this because I'm no longer interested in maintaining the PR state. I try not to use Jest anymore, partly due to the lack of response to my contribution/interesting in responding to feature requests like this. If someone else wants to rebase the work on the PR and re-raise feel free. |
🐛 Bug Report
When defining multiple projects via the
projects
config option, where one project hasmaxWorkers
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
maxWorkers: 1
projects
propertyExpected behavior / Proposal
I propose the following:
maxWorkers
setting in base configmaxWorkers
found in all projects config filesmaxWorkers
# of workersEffectively, this ensures that
maxWorkers
behaviour matches that of running jest on an individual project.envinfo
The text was updated successfully, but these errors were encountered: