Allow passing --changed cli option to vitest

Open
#32,343 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
cli, testing

Research direction

Start at the unit-test builder options and trace how they are passed to the Vitest runner. Verify that a changed string option forwards --changed and that the relevant builder tests cover the resulting command.

Written by the indexing model from the issue text.

Description

angular/build:unit-test area: @angular/build feature feature: votes required
Command

test

Description

The unit-test builder does not provide a way to use the --changed vitest option: https://vitest.dev/guide/cli.html#changed. This will analyze the import graph and only run tests affected by a change, which is useful for running a subset of the test suite for pull requests. This option is not available through the vitest configuration file.

Describe the solution you'd like

Add a changed: <string> option to the unit-test builder options which passes --changed <string> to the vitest runner.

Describe alternatives you've considered

I don't think there are any good workarounds. Using @analogjs/vitest-angular exposes vitest directly, but requires more setup and is not an "official" package.

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.