Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 23, 2025

This commit updates the application, ng-new, and library schematics to configure Vitest as the default unit testing runner, replacing Karma and Jasmine. It also introduces a testRunner option to allow users to choose between vitest and karma.

Application & ng new Schematics:

  • Adds a testRunner option to allow choosing between vitest (default) and karma.
  • Sets "@angular/build:unit-test" as the builder for the "test" target when vitest is chosen, and "@angular/build:karma" for karma.
  • Conditionally adds dependencies based on the selected runner.
  • Updates "tsconfig.spec.json" to include "vitest/globals" or "jasmine" for type support.

Library Schematic:

  • Conditionally configures the "test" target with the "@angular/build:unit-test" builder if Vitest is detected in the workspace.
  • Dynamically sets the "types" in "tsconfig.spec.json" to "vitest/globals" or "jasmine" based on the presence of Vitest.

@clydin clydin force-pushed the vitest/default-new-projects branch 6 times, most recently from 31a6f6f to d698d39 Compare October 23, 2025 12:45
@clydin clydin marked this pull request as ready for review October 23, 2025 12:59
…w runner choice

This commit updates the application, ng-new, and library schematics to configure Vitest as the default unit testing runner, replacing Karma and Jasmine. It also introduces a `testRunner` option to allow users to choose between `vitest` and `karma`.

Key changes:

Application & Ng-New Schematics:
- Adds a `testRunner` option to allow choosing between `vitest` (default) and `karma`.
- Sets "@angular/build:unit-test" as the builder for the "test" target when `vitest` is chosen, and "@angular/build:karma" for `karma`.
- Conditionally adds dependencies based on the selected runner.
- Updates "tsconfig.spec.json" to include "vitest/globals" or "jasmine" for type support.

Library Schematic:
- Conditionally configures the "test" target with the "@angular/build:unit-test" builder if Vitest is detected in the workspace.
- Dynamically sets the "types" in "tsconfig.spec.json" to "vitest/globals" or "jasmine" based on the presence of Vitest.
@clydin clydin force-pushed the vitest/default-new-projects branch from d698d39 to 8f82898 Compare October 23, 2025 13:04
@clydin clydin requested a review from alan-agius4 October 23, 2025 13:05
@alan-agius4 alan-agius4 added target: major This PR is targeted for the next major release action: merge The PR is ready for merge by the caretaker labels Oct 23, 2025
@alan-agius4 alan-agius4 merged commit 2ffc527 into angular:main Oct 23, 2025
33 checks passed
@clydin clydin deleted the vitest/default-new-projects branch October 23, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @schematics/angular detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants