Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Once the project is built, you can publish your library by following these steps

## 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:


```bash
ng test
Expand Down
Loading