Commit 592db81
refactor(test): drive preventBadQueries spec off onSearchComplete
The previous version scheduled three actions via wall-clock setTimeout
(10/20/30 ms) and waited for `ajaxCount === 2` to resolve a Promise
seeded inside `beforeEach`. Under load — particularly the fork-pool
cold-start path on Windows — the timeouts bunched up or the resolver
never fired, hitting the 10-second hook timeout. We saw the flake
three times in one session.
Rewrite the test to drive off the plugin's own `onSearchComplete`
callback, which fires for every query attempt (ajax success, ajax
failure, and bad-query short-circuit alike). Each action awaits the
next `onSearchComplete` directly — no wall clock, no nested setTimeout
chain, no race window.
5/5 consecutive local runs pass in ~50ms (was ~11s when passing,
10000+ ms when flaking).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ce18d0d commit 592db81
1 file changed
Lines changed: 44 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
318 | 321 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
324 | 329 | | |
325 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
326 | 338 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
338 | 347 | | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
344 | 353 | | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
349 | 360 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
357 | 367 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | 368 | | |
362 | 369 | | |
363 | 370 | | |
| |||
0 commit comments