test: avoid repeated writes in watch helper#63386
Open
trivikr wants to merge 1 commit into
Open
Conversation
Use performFileOperation() for test runner watch updates so the run() API path schedules a single delayed write instead of rewriting the file until the second run completes. Repeated writes can trigger another watch restart while the previous rerun is still active. The runner then terminates the in-flight child process with SIGTERM, which can make the captured output include both a failed file-level subtest and the next successful run. Also count only root summary duration lines when detecting completed runs. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
65f5bf7 to
8f08bd1
Compare
Member
Author
|
This is also expected to fix flakiness in |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63386 +/- ##
==========================================
- Coverage 90.06% 90.05% -0.01%
==========================================
Files 714 714
Lines 225629 225648 +19
Branches 42702 42704 +2
==========================================
- Hits 203211 203209 -2
- Misses 14232 14233 +1
- Partials 8186 8206 +20 🚀 New features to boost your workflow:
|
aduh95
approved these changes
May 18, 2026
This comment was marked as outdated.
This comment was marked as outdated.
Collaborator
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.
The shared watch helper was repeatedly writing the watched file in the
run({ watch: true })update path until the second run completed. On slow CI,that can trigger another watch restart while the previous rerun is still
active. The test runner then terminates the in-flight child process with
SIGTERM, and the captured output can include both a failed file-level subtestand the next successful run.
This changes the update path to use
performFileOperation(), matching thehelper’s rename/create paths. For the
run()API path, that schedules a singledelayed write instead of rewriting until the second run completes. The helper
still waits for the next completed run before asserting output.
This also tightens run completion detection to count only root summary
duration_mslines, instead of anyduration_msfield in the TAP output.Historical context:
common.platformTimeout(1000).run()API watchpath when the monolithic watch test was split.
The repeated-write retry helped ensure the watcher observed a change, but
keeping it active until the whole second run completes creates a new race.
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-05-17.md#jstest-failure
Assisted-by: openai:gpt-5.5