-
-
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
[Feature]: Allow option to detect if jest is currently running in watch mode #12271
Comments
Right, we only pass you |
A few reasons for this change: * The behavior of `yarn test` was a bit unclear, there were a few conditions where it would not run in "watch" mode (CI, pre-commit, exporting coverage stats) * We were having issues in "watch" mode due to `jest-sentry-environment`. Our wrapper script called `jest` via node API w/ "watch" mode as an arg, while `jest-sentry-environment` checked the global `process.argv` for "watch" mode. This is because the run options are not passed to the jest environment, and there is no other way to determine "watch" mode. (Note: this is fixed in v28 of jest, but it is currently in pre-release: jestjs/jest#12271). Now instead of running "watch" mode depending on the runtime environment, add an explicit task `test-watch` to run `jest` in "watch" mode.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
Add a way to detect (in a jest environment and possibly elsewhere) for when jest is running in "watch" mode.
Motivation
We have a custom jest environment where we are instrumenting our tests and we'd like to be able to disable the feature in
watch
mode. Currently you can checkprocess.argv
for--watch
, but this doesn't work if you calljest.run(<argv>)
outside of CLI.Example
I would expect it to be available in the environment's constructor:
Pitch
This feature belongs in core because it's already an option in core and just needs to be exposed.
The text was updated successfully, but these errors were encountered: