Repository navigation
Conversation
…cutor The Vitest CLI level options were assembled inline within the Vitest executor's initialization. They are now created by a dedicated function which allows the mapping from the builder options to be unit tested without starting Vitest. There is no change in behavior.
clydin
force-pushed
the
unit-test-runner-args
branch
from
November 13, 2026 19:54
374dfa5 to
c0dbeb7
Compare
The unit-test builder now supports a `runnerArgs` option that provides additional command line arguments to the Vitest runner. For example, `ng test --runner-args=--update` updates existing snapshots and `ng test --runner-args=--bail=1` stops the run after the first failure. The option can also be configured within the `angular.json` file. The arguments are parsed with the Vitest command line parser and then validated against a list of supported Vitest options. The Vitest parser accepts unknown options, command names, and test file filters without error. The validation ensures that a misspelled or unsupported argument fails the build with a descriptive message instead of being ignored. Vitest options with an equivalent builder option, such as `--reporter` and `--coverage`, are rejected with a reference to the builder option. The initially supported Vitest options are `--allowOnly`, `--bail`, `--disableConsoleIntercept`, `--expandSnapshotDiff`, `--maxWorkers`, `--printConsoleTrace`, `--retry`, `--sequence.seed`, `--sequence.shuffle`, `--shard`, `--testTimeout`, and `--update`. The supported options take precedence over a Vitest configuration file but not over the other builder options. The option is not available for the Karma runner.
clydin
force-pushed
the
unit-test-runner-args
branch
from
November 13, 2026 20:19
c0dbeb7 to
5452b1a
Compare
clydin
marked this pull request as ready for review
November 13, 2026 20:39
There was a problem hiding this comment.
Code Review
This pull request introduces a new runnerArgs option to the Angular unit-test builder, allowing users to pass additional command-line arguments to the Vitest runner. It includes validation logic to ensure only a supported subset of Vitest CLI options are allowed. Feedback on the changes highlights an issue with the color option validation, which currently prevents users from explicitly disabling colors (e.g., via --no-color or --color=false). A code suggestion has been provided to properly handle boolean values for the color option.
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.
The unit-test builder now supports a
runnerArgsoption that providesadditional command line arguments to the Vitest runner. For example,
ng test --runner-args=--updateupdates existing snapshots andng test --runner-args=--bail=1stops the run after the first failure.The option can also be configured within the
angular.jsonfile.The arguments are parsed with the Vitest command line parser and then
validated against a list of supported Vitest options. The Vitest parser
accepts unknown options, command names, and test file filters without
error. The validation ensures that a misspelled or unsupported argument
fails the build with a descriptive message instead of being ignored.
Vitest options with an equivalent builder option, such as
--reporterand
--coverage, are rejected with a reference to the builder option.The initially supported Vitest options are
--allowOnly,--bail,--disableConsoleIntercept,--expandSnapshotDiff,--maxWorkers,--printConsoleTrace,--retry,--sequence.seed,--sequence.shuffle,--shard,--testTimeout, and--update.The supported options take precedence over a Vitest configuration file
but not over the other builder options. The option is not available for
the Karma runner.