test_runner: apply run() name filters with isolation none#64376
Open
UditDewan wants to merge 1 commit into
Open
test_runner: apply run() name filters with isolation none#64376UditDewan wants to merge 1 commit into
UditDewan wants to merge 1 commit into
Conversation
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
Collaborator
|
Review requested:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
run()validatestestNamePatternsandtestSkipPatternsand forwards them to spawned processes as--test-name-pattern/--test-skip-patternflags, but never applies them to the root test's configuration. Withisolation: '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=nonebecause the test runner entry point passes the memoizedparseCommandLine()options object torun(), which spreads it into the root configuration.Fix
Apply the validated patterns to the root test configuration when
isolationis'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, wherenode --test --watch --test-isolation=none --test-name-pattern=...runs nothing. Since aFileTestrepresents 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, likeTestHookalready is.Fixes: #64359