Skip to content

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

Open
inukshuk wants to merge 2 commits into
nodejs: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 into
nodejs:mainfrom
inukshuk:fix/test-runner-no-isolation-missing-opts

Conversation

@inukshuk
Copy link
Copy Markdown

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).

@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 Mar 15, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.05%. Comparing base (676e9da) to head (4aa5683).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62269      +/-   ##
==========================================
+ Coverage   90.03%   90.05%   +0.01%     
==========================================
  Files         714      714              
  Lines      225352   225364      +12     
  Branches    42599    42612      +13     
==========================================
+ Hits       202905   202948      +43     
+ Misses      14236    14190      -46     
- Partials     8211     8226      +15     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 93.64% <100.00%> (+0.07%) ⬆️

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

inukshuk added 2 commits May 15, 2026 12:38
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.
@inukshuk inukshuk force-pushed the fix/test-runner-no-isolation-missing-opts branch from 8637ae0 to 4aa5683 Compare May 15, 2026 10:39
@inukshuk
Copy link
Copy Markdown
Author

I rebased this on main to make sure it's still working.

For added context, I'm working with the test runner in Electron where there are substantial differences to the process model and it would be very helpful to have all the run() options available even with isolation turned off. Happy to explore this further/differently if that would be preferable.

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label May 16, 2026
@mcollina
Copy link
Copy Markdown
Member

The commit is missing the signoff.

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 16, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

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"

4 participants