-
-
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
feat: allow runInBand
to be configured at project level
#10912
Conversation
Hi @freshollie! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
1 similar comment
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Splitting this into a runner is possible, but requires mostly duplicating logic already found in |
46e7472
to
cf43b72
Compare
Codecov Report
@@ Coverage Diff @@
## main #10912 +/- ##
=======================================
Coverage 66.97% 66.98%
=======================================
Files 329 329
Lines 17341 17355 +14
Branches 5066 5070 +4
=======================================
+ Hits 11615 11625 +10
- Misses 5694 5698 +4
Partials 32 32
Continue to review full report at Codecov.
|
runInBand
to be configured at project level
8255af9
to
8accf67
Compare
### `runInBand` [boolean] | ||
|
||
Default: `false` | ||
|
||
This option allows the test runner to know how it runs your tests at a project level. | ||
|
||
Sometimes it's desirable for a specific package within your repository to run tests in band, such as integration tests, and for other packages in the same repository to run tests in parallel. | ||
|
||
When configured in the root jest configuration, all tests will be run in band. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried to describe the usage here, but looking for feedback
@@ -0,0 +1,76 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests could be moved to multi-project e2es, found it simpler to keep them separate
"description": "Testing the behaviour of runInBand at project level", | ||
"jest": { | ||
"projects": ["./*/jest.config.js"], | ||
"maxWorkers": 9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that under normal circumstances, all tests would be run at the same time
This would be extremely useful for me, having integration tests in a monorepo. My life will get better when this is merged. |
289dce7
to
867b596
Compare
867b596
to
eb49789
Compare
@revmischa I'm considering re-opening this PR it seems to have been buried... |
This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
It's fine, switching to vitest greatly improved my life |
@revmischa same lol |
This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
Sorry all, got no feedback on this and I'm no longer interested in using Jest. We've found vitest fits all our use cases. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Lots of feedback from people looking for this feature in #10936
Currently running tests in band has to be configured on a global level through
--runInBand
arg.This doesn't take into account some projects (particularly monorepos) which may need to be granular in this setting at a project level, some packages may be able to run tests in parallel, while others, integration tests for example, may require that all tests are run serially.
Because jest already has the mechanism to run tests across multiple projects, it makes sense that this setting is available to be switched on at a per project level, where the overall test strategy will be in parallel, but tests in an individual project will run in serial.
Example
Test plan