Skip to content

test: fix watch cwd argv test flake#64084

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-run-watch-cwd-isolation-none-argv
Open

test: fix watch cwd argv test flake#64084
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-run-watch-cwd-isolation-none-argv

Conversation

@trivikr

@trivikr trivikr commented Jun 23, 2026

Copy link
Copy Markdown
Member

This fixes a flaky watch mode test by keeping the marker file outside the
watched cwd.

The test runs run({ watch: true, cwd, isolation: 'none' }) without explicit
files, so the runner watches the whole cwd. On Linux, writing the marker file
inside that cwd can trigger a watch restart before the test aborts the stream,
causing a second test:pass event.

The marker is now written in the parent tmpdir while the test file lives in a
dedicated watched subdirectory.

Refs: https://github.com/nodejs/reliability/issues?q=sort%3Aupdated-desc%20is%3Aissue%20state%3Aopen%20%22test-run-watch-cwd-isolation-none-argv%22

Example
not ok 5145 test-runner/test-run-watch-cwd-isolation-none-argv
  ---
  duration_ms: 866.79500
  severity: fail
  exitcode: 1
  stack: |-
    Mismatched noop function calls. Expected exactly 1, actual 2.
        at Module.mustCall (/home/iojs/build/workspace/node-test-commit-linuxone/test/common/index.js:468:10)
        at file:///home/iojs/build/workspace/node-test-commit-linuxone/test/test-runner/test-run-watch-cwd-isolation-none-argv.mjs:39:31
        at ModuleJob.run (node:internal/modules/esm/module_job:447:25)
        at async node:internal/modules/esm/loader:646:26
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Assisted-by: openai:gpt-5.5

Keep the marker file outside the watched cwd so writing it does not
trigger an extra watch mode rerun on Linux.

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 Jun 23, 2026
@trivikr trivikr added test_runner Issues and PRs related to the test runner subsystem. flaky-test Issues and PRs related to the tests with unstable failures on the CI. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flaky-test Issues and PRs related to the tests with unstable failures on the CI. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. test_runner Issues and PRs related to the test runner subsystem. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants