docs: mention Vitest instead of Karma in README template of schematic…#33573
docs: mention Vitest instead of Karma in README template of schematic…#33573guisalmeida wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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:
PR Checklist
Please check to confirm your PR fulfils the following requirements:
PR Type
What kind of change does this PR introduce?
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?
Other information
Found a similar change in #31916, but it seems this part in the schematic/library files was forgotten to change as well.