Skip to content

docs: mention Vitest instead of Karma in README template of schematic…#33573

Open
guisalmeida wants to merge 1 commit into
angular:mainfrom
guisalmeida:guisalmeida-patch-1
Open

docs: mention Vitest instead of Karma in README template of schematic…#33573
guisalmeida wants to merge 1 commit into
angular:mainfrom
guisalmeida:guisalmeida-patch-1

Conversation

@guisalmeida

Copy link
Copy Markdown

PR Checklist

Please check to confirm your PR fulfils the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Since version Angular 21, Vitest is the default test runner.

Issue Number: N/A

What is the new behavior?

Mention Vitest instead of Karma.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Found a similar change in #31916, but it seems this part in the schematic/library files was forgotten to change as well.

@angular-robot angular-robot Bot added the area: docs Related to the documentation label Jul 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the library README template to reference the Vitest test runner instead of Karma. The review feedback correctly points out that since Karma is still supported as a fallback, hardcoding Vitest will lead to incorrect documentation. It is recommended to dynamically display the test runner name based on the template context.

## Running unit tests

To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the library schematic still supports Karma as a test runner (as seen in packages/schematics/angular/library/index.ts where it falls back to the Karma builder if Vitest is not selected), hardcoding Vitest in the README template will result in incorrect documentation when a user generates a library with Karma.

We can dynamically display the correct test runner in the README by checking the testTypesPackage template variable, which is already passed to the template context.

To execute unit tests with the <%= testTypesPackage === 'vitest/globals' ? '[Vitest](https://vitest.dev/)' : '[Karma](https://karma-runner.github.io)' %> test runner, use the following command:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Related to the documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant