Skip to content

test_runner: use run() options with isolation="none"#62269

Open
inukshuk wants to merge 2 commits intonodejs:mainfrom
inukshuk:fix/test-runner-no-isolation-missing-opts
Open

test_runner: use run() options with isolation="none"#62269
inukshuk wants to merge 2 commits intonodejs:mainfrom
inukshuk:fix/test-runner-no-isolation-missing-opts

Conversation

@inukshuk
Copy link

When using run() programatically with isolation="none", testNamePatterns, testSkipPatterns, and only were ignored. This combination of options only worked when set via CLI flags, because parseCommandLine() is still used to seed globalOptions.

Closes #57399

This is almost the same as #58496 which was my starting point for this. The original PR did not address only, which is equally missing. It also did not overwrite the options if they were already in globalOptions: the only way for them to be there is via parseCommandLine() above. However, I believe we need to always override them. When run() is used in code with these options, I'd always expect them to take effect and this is also what already happens with isolation="process", which forward the run() options to the child process not the CLI ones.

This also uses a fixture for running the tests as was requested in the original PR.

The test spawns a child process, because running a test within the currently running test without isolation is problematic (tests would hang for me, could be related to #57394 but it's arguably not something that should be done).

When using run() programatically with isolation="none",
testNamePatterns, testSkipPattersn, and only were ignored.
This combination of options only worked when set via CLI flags,
because parseCommandLine() is still used to seed globalOptions.
@nodejs-github-bot
Copy link
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 Mar 15, 2026
@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.67%. Comparing base (82409af) to head (8637ae0).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62269      +/-   ##
==========================================
- Coverage   89.67%   89.67%   -0.01%     
==========================================
  Files         676      676              
  Lines      206555   206568      +13     
  Branches    39552    39565      +13     
==========================================
+ Hits       185225   185230       +5     
- Misses      13448    13454       +6     
- Partials     7882     7884       +2     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 93.28% <100.00%> (+0.08%) ⬆️

... and 25 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. 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 and testSkipPatterns when isolation is "none"

2 participants