Skip to content

test_runner: fix watch cwd with isolation none#63690

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

test_runner: fix watch cwd with isolation none#63690
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:test-run-watch-cwd-isolation-none

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Jun 1, 2026

When run({ watch: true, cwd, isolation: 'none' }) spawned the watch child,
it reused the parent process argv while changing the child process cwd. That
could make the child run the outer test file, recurse, or miss the test file
that was discovered under the configured cwd.

This updates the isolation-none watch path to spawn the child test runner with
the current run's explicit files or glob patterns instead of process.argv.
A regression test verifies that the cwd-scoped test file actually runs.

Fixes: #63689


Fixes a flaky failure in test-runner/test-run-watch-cwd-isolation-none.
Refs: https://github.com/nodejs/reliability/blob/main/reports/2026-06-01.md#jstest-failure

Example error log
not ok 5115 test-runner/test-run-watch-cwd-isolation-none
  ---
  duration_ms: 1588.88400
  severity: fail
  exitcode: 1
  stack: |-
  ...

Assisted-by: openai:gpt-5.5

@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/test_runner

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Jun 1, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 1, 2026
When watch mode runs with isolation disabled, spawn the child test
runner with the files or glob patterns from the current run instead
of reusing the parent process argv.

This keeps discovery scoped to the configured cwd and avoids rerunning
the driver test when the parent argv points outside that cwd.

Fixes: nodejs#63689

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@trivikr trivikr force-pushed the test-run-watch-cwd-isolation-none branch from 7e54c89 to 423a1e2 Compare June 1, 2026 06:54
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (aa444b2) to head (423a1e2).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/test_runner/runner.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63690      +/-   ##
==========================================
- Coverage   90.35%   90.35%   -0.01%     
==========================================
  Files         732      732              
  Lines      236527   236531       +4     
  Branches    44535    44536       +1     
==========================================
- Hits       213717   213716       -1     
+ Misses      14533    14531       -2     
- Partials     8277     8284       +7     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.40% <83.33%> (-0.07%) ⬇️

... and 22 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.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:test watch mode with isolation: 'none' ignores cwd-scoped discovery and reuses parent argv

2 participants