Skip to content

test: deflake watch mode worker test#63384

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:flaky-test-watch-mode-worker
Open

test: deflake watch mode worker test#63384
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:flaky-test-watch-mode-worker

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 17, 2026

Fixes an intermittent failure in test-watch-mode-worker.mjs.

The test previously triggered watch restarts by repeatedly rewriting the
watched file with writeFileSync(). Since that truncates before writing, a
restarted ESM worker could occasionally observe an empty or partially written
nested dependency and fail with a missing default export error.

This PR changes the restart trigger to append harmless whitespace instead, so
the watched module remains valid while still producing a file change event. It
also gives each subtest its own temporary directory to avoid shared
worker.*/dep.*/sub-dep.* paths when subtests run concurrently.

Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-05-17.md#jstest-failure


Assisted-by: openai:gpt-5.5

Trigger watch restarts by appending whitespace instead of rewriting
watched modules. This avoids transient empty or partial ESM dependency
contents while the restarted worker is loading.

Use a separate temporary directory for each subtest so concurrent
subtests do not share worker and dependency file names.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels May 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (a9b0a83) to head (63c1f3f).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63384      +/-   ##
==========================================
- Coverage   90.06%   90.05%   -0.02%     
==========================================
  Files         714      714              
  Lines      225629   225629              
  Branches    42702    42674      -28     
==========================================
- Hits       203211   203185      -26     
+ Misses      14232    14222      -10     
- Partials     8186     8222      +36     

see 50 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label May 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 17, 2026
@nodejs-github-bot

This comment was marked as outdated.

@trivikr trivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 17, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants