test: stabilize flaky fs.watch and worker-scaler tests - #4806
Merged
Merged
Conversation
- Skip the two FileWatcher tests that exercise fs.watch on Windows + Node 24 to avoid the libuv assertion in src/win/fs-event.c tracked upstream as nodejs/node#63638. - Replace the single short CPU burst + fixed sleep in the worker-scaler cooldown test with sustained load and polling for the expected worker count, so the scale-up is observed deterministically. Assisted-by: claude-code:claude-opus-4-7 Signed-off-by: Matteo Collina <[email protected]>
mcollina
requested review from
ShogunPanda and
ivan-tymoshenko
and removed request for
ShogunPanda
May 29, 2026 10:35
ivan-tymoshenko
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FileWatchertests that exercisefs.watchon Windows + Node 24. They abort the process withAssertion failed: !_wcsnicmp(filename, dir, dirlen), file src\win\fs-event.c, line 72— a libuv regression tracked upstream at nodejs/node#63638. The skip is gated onprocess.platform === 'win32' && Node ≥ 24so the tests keep running everywhere they're known to be safe.worker-scaler"should not scale during cooldown" test to drive sustained CPU load in the background and poll for the expected worker count instead of issuing a single short burst and sleeping a fixed 10s. The original shape was timing-fragile: the worker was blocked during the burst, the scaler's health check often couldn't observe the high ELU before the load ended, and the assertion landed at 1 worker instead of 2. With polling and continuous load the scale-up is observed deterministically — typical run time dropped to ~2s, with a 30s upper bound.Test plan
packages/foundation—node --test test/file-system.test.js(22/22 pass locally on Linux + Node 24)packages/runtime—node --test --test-concurrency=1 test/worker-scaler-1.test.js(15/15 pass locally; the previously flaky cooldown test passes in bothdefaultandworker-scalerconfigurations)foundation - windows-2025 - 24andruntime - * - mainjobs are green🤖 Generated with Claude Code