Repository navigation
Commit d38be99
authored
test: poll at the gap the watch suites write at (#22181)
* test: poll at the gap the watch suites write at
`runtimes (deno)` fails intermittently on WatchDetection's tightest case —
"time between changes 10ms with invalidate call" — waiting out jest's 30s
budget for `done()`. Three things around it were wrong.
The interval was an order of magnitude coarser than the gap it had to
resolve: the harness forces `WATCHPACK_POLLING=100` because Deno's and Bun's
`node:fs.watch` drop change events under jest's worker threads, while that
case writes the same file twice 10ms apart. Both setups now poll at 10ms,
which is no slower — measured over a 40-case slice of WatchTestCases and of
WatchCacheUnaffectedTestCases, 16.9s against 18.4s at 100ms.
The test's own `poll: 100` never applied: `DirectoryWatcher` assigns
`options.poll = FORCE_POLLING` on every watcher whenever the env var is set,
so the option could not differ from it and tuning it did nothing. It is gone,
and the comment says where the interval comes from.
And jest's default budget is not this test's to keep: where the harness polls,
each change costs an interval to notice and this case walks several
change-and-rebuild round trips, so it now gets 120s there and the default
everywhere else.
* test: retry the change WatchDetection's last step waits on
The first attempt was wrong. Polling at the gap the case writes at did not fix
the `runtimes (deno)` failure — it failed again on that head, and at 120000ms,
so the test stalls rather than runs slow and no budget rescues it. Both the
interval and the raised timeout are reverted; the timeout only made a red run
90s longer.
The stall is structural. Every other step advances on its own timer, but the
last one advances only when a `done` arrives carrying "correct", and nothing
retries. A watcher that drops or coalesces that single change strands the test
forever — which is what Deno's node:fs.watch compat does under jest's worker
threads, and why polling is forced there at all.
It now re-touches the file until the rebuild carrying it arrives, so a dropped
event costs a retry instead of the suite. The assertion is unchanged: webpack
still has to rebuild and put "correct" in the bundle.
Also drops the test's own `poll` option, which never applied: DirectoryWatcher
assigns options.poll = FORCE_POLLING on every watcher whenever WATCHPACK_POLLING
is set, so it could not differ from it.
* test: clear the watch retry interval on every exit path1 parent 1d75746 commit d38be99
1 file changed
Lines changed: 19 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
47 | 52 | | |
48 | 53 | | |
49 | 54 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
| |||
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
119 | 128 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
178 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
185 | 193 | | |
| 194 | + | |
| 195 | + | |
186 | 196 | | |
187 | 197 | | |
188 | 198 | | |
| |||
0 commit comments