Skip to content

test_runner: apply run() name filters with isolation none - #64376

Open
UditDewan wants to merge 1 commit into
nodejs:mainfrom
UditDewan:fix-run-isolation-none-patterns
Open

UditDewan wants to merge 1 commit into
nodejs:mainfrom
UditDewan:fix-run-isolation-none-patterns

Conversation

@UditDewan

Copy link
Copy Markdown

Problem

run() validates testNamePatterns and testSkipPatterns and forwards them to spawned processes as --test-name-pattern/--test-skip-pattern flags, but never applies them to the root test's configuration. With isolation: 'none' there are no spawned processes — the test files are imported into the current process — so both options were silently ignored and every test ran.

The same filters do work as CLI flags under --test-isolation=none because the test runner entry point passes the memoized parseCommandLine() options object to run(), which spreads it into the root configuration.

Fix

Apply the validated patterns to the root test configuration when isolation is 'none'.

Doing only that would break watch mode with isolation: 'none', where a file level test with an empty name wraps the single spawned process: the name filter would reject it and no test would ever run. The equivalent breakage is observable today on the CLI, where node --test --watch --test-isolation=none --test-name-pattern=... runs nothing. Since a FileTest represents a test file rather than a named test — the patterns are applied to the tests inside the file by the spawned process — it is now exempt from name filtering, like TestHook already is.

Fixes: #64359

@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 Jul 9, 2026
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Jul 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.11%. Comparing base (0032189) to head (a0cf638).
⚠️ Report is 784 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64376      +/-   ##
==========================================
- Coverage   90.23%   90.11%   -0.12%     
==========================================
  Files         741      741              
  Lines      241194   242164     +970     
  Branches    45432    45576     +144     
==========================================
+ Hits       217640   218234     +594     
- Misses      15129    15441     +312     
- Partials     8425     8489      +64     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.67% <100.00%> (+0.24%) ⬆️

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

@trivikr

This comment was marked as outdated.

@UditDewan
UditDewan force-pushed the fix-run-isolation-none-patterns branch from 60aba6b to a0cf638 Compare July 22, 2026 05:45
@trivikr
trivikr requested a review from avivkeller August 9, 2026 07:47
@trivikr trivikr removed the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Aug 11, 2026
@trivikr

trivikr commented Aug 23, 2026

Copy link
Copy Markdown
Member

This needs a rebase

Since run() applies testNamePatterns and testSkipPatterns to the root
test configuration under isolation 'none', the file level test that
wraps the single spawned process in watch mode is filtered by name
itself. Its name is empty, so any name pattern filtered it out and no
test ever ran. The same happens on the CLI with
`--test --watch --test-isolation=none --test-name-pattern=...`.

Exempt file wrappers from name filtering, as is already done for tag
filtering: the patterns are applied to the tests inside of the file by
the child process.

Refs: nodejs#64359
Refs: nodejs#62269

Signed-off-by: uditDewan <udit.dewan21@gmail.com>
@UditDewan
UditDewan force-pushed the fix-run-isolation-none-patterns branch from a0cf638 to 5b60677 Compare September 14, 2026 18:04
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. test_runner Issues and PRs related to the test runner subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test Runner] run() ignores testNamePatterns / testSkipPatterns when `isolation: 'none'

4 participants