-
-
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
Always use workers when using the watch mode #6647
Conversation
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.
nice fix! can you also add watchAll
?
@thymikee done 🙂 I'll wait for the build to finish. |
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.
Aaaah, great catch!
Missing changelog though :D
Not sure it fixes 6599, though? |
@SimenB added too! |
@SimenB looks like it should fix it, now the main thread is not blocked |
@SimenB it fixes it. The issue is that they're executing
|
cc / @gaearon |
Can you check out the comment here: #6599 (comment) If we know the duration of the test, and the test runs faster than about three seconds can we run in band? The reason is that most people's tests are faster than that, so interrupting doesn't make sense. The single test run in band may be lots faster than than the startup time of node + reading a large haste map (at FB). Also consider how we may have an in-memory transform cache in the main process already. I think optimizing for that case is worth it because focusing on a single fast test is a common thing people do. |
I agree with the former, but if we go that way, I'd set up a one second limit. As stated by Nielsen, one second is about the limit for the user's flow of thought to stay uninterrupted. |
I'm fine with one second too. While this change makes things better for slow tests, I also wanna make sure we don't make it worse for all the fast tests out there. |
Codecov Report
@@ Coverage Diff @@
## master #6647 +/- ##
==========================================
+ Coverage 63.73% 63.76% +0.02%
==========================================
Files 235 235
Lines 8935 8935
Branches 4 4
==========================================
+ Hits 5695 5697 +2
+ Misses 3239 3237 -2
Partials 1 1
Continue to review full report at Codecov.
|
I'm trying this in Prepack, and it definitely fixes |
Here's a gif. I'm changing the code to something that would clearly break it. It doesn't interrupt the ongoing test. Once the test prints success, I save the file again, and now it re-runs and shows failure (this part didn't fit in the gif but trust me it happens). Testing methodology: I applied this patch alone to compiled |
This Pull Request updates dependency [jest](https://github.com/facebook/jest) from `v23.3.0` to `v23.4.0` <details> <summary>Release Notes</summary> ### [`v23.4.0`](https://github.com/facebook/jest/blob/master/CHANGELOG.md#​2340) [Compare Source](jestjs/jest@v23.3.0...v23.4.0) ##### Features - `[jest-haste-map]` Add `computeDependencies` flag to avoid opening files if not needed ([#​6667](`https://github.com/facebook/jest/pull/6667`)) - `[jest-runtime]` Support `require.resolve.paths` ([#​6471](`https://github.com/facebook/jest/pull/6471`)) - `[jest-runtime]` Support `paths` option for `require.resolve` ([#​6471](`https://github.com/facebook/jest/pull/6471`)) ##### Fixes - `[jest-runner]` Force parallel runs for watch mode, to avoid TTY freeze ([#​6647](`https://github.com/facebook/jest/pull/6647`)) - `[jest-cli]` properly reprint resolver errors in watch mode ([#​6407](`https://github.com/facebook/jest/pull/6407`)) - `[jest-cli]` Write configuration to stdout when the option was explicitly passed to Jest ([#​6447](`https://github.com/facebook/jest/pull/6447`)) - `[jest-cli]` Fix regression on non-matching suites ([6657](`https://github.com/facebook/jest/pull/6657`)) - `[jest-runtime]` Roll back `micromatch` version to prevent regression when matching files ([#​6661](`https://github.com/facebook/jest/pull/6661`)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com).
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. |
When using the
watch
mode, we use the TTY as an input mechanism (for keystrokes), so that different options can be selected. When only one test is selected, it will run by default in band, which causes the TTY to be unresponsive.Blacklisting "in band" mode when using the
watch
mode fixes the issue, since tests are executed in workers, freeing the main process.Fixes #6599.