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

test_runner: apply run() name filters with isolation none#64376
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

The testNamePatterns and testSkipPatterns options of run() were only
forwarded to spawned processes as CLI flags, so they were silently
ignored when isolation was 'none' and tests ran in the current
process. Apply the validated patterns to the root test configuration
in that case.

Exempt file level tests from name filtering: they represent test
files rather than named tests, and filtering them prevented any test
from running in watch mode when the root configuration contained name
patterns.

Fixes: nodejs#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. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jul 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. 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.25%. Comparing base (0032189) to head (60aba6b).
⚠️ Report is 97 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64376      +/-   ##
==========================================
+ Coverage   90.23%   90.25%   +0.01%     
==========================================
  Files         741      741              
  Lines      241194   241209      +15     
  Branches    45432    45429       -3     
==========================================
+ Hits       217640   217692      +52     
+ Misses      15129    15079      -50     
- Partials     8425     8438      +13     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 94.67% <100.00%> (+0.24%) ⬆️

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

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_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