Repository navigation
chore: run tests with the Angular unit-test builder - #17
Merged
Garfield-fr merged 1 commit intoNov 24, 2026
Merged
Conversation
Angular 22.3 deprecates the testRunner schematic option: Vitest through @angular/build:unit-test is becoming the only supported setup. Tests now run with this builder instead of Analog. - angular.json: test target uses @angular/build:unit-test, with the coverage settings previously in vite.config.mts - scripts: test, test:watch and test:coverage call ng test - remove vite.config.mts, src/test-setup.ts and the two @analogjs packages: the builder compiles the specs, resolves the tsconfig path aliases and initializes TestBed itself - tsconfig.spec.json: drop the node types, which only resolved through Analog and are not used by the specs - VS Code: debug configurations run ng test, and the Vitest extension is no longer recommended because it runs Vitest without the Angular build Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests now run with Angular's official Vitest integration (
@angular/build:unit-test) instead of Analog (@analogjs/vitest-angular). They still use Vitest, jsdom and@vitest/coverage-v8; only the way specs are compiled and run changes.Why: Angular 22.3 deprecates the
testRunnerschematic option and announces that new projects will only be configured with Vitest through this builder. Moving now keeps the project on the setup the Angular team supports, and removes two third-party packages and their config files.Changes
angular.json: thetesttarget uses@angular/build:unit-test. The coverage settings fromvite.config.mts(include, exclude,textandlcovreporters) moved here.test,test:watchandtest:coveragekeep their names and now callng test..ai/dev-commands.mdis unchanged.vite.config.mts,src/test-setup.ts,@analogjs/vite-plugin-angularand@analogjs/vitest-angular. The builder compiles the specs, resolves the@env/*and@shared/*aliases fromtsconfig.json, and initializes TestBed (zoneless) itself. No spec used Analog's snapshot serializers.tsconfig.spec.json: dropsnodefromtypes.@types/nodewas only installed through Analog, and no spec uses Node APIs.launch.json: the two test debug configurations now runng test(current file with--include, or all tests).extensions.json: no longer recommends the Vitest extension (vitest.explorer). It runs Vitest directly, without the Angular build, so it cannot run these tests anymore.Trade-off
The VS Code Testing panel (run or debug a single test from the editor gutter) is lost with the Vitest extension. Running and debugging tests goes through
pnpm test/pnpm test:watchor theng testlaunch configurations.Checks
pnpm test: 22/22 tests passpnpm test:coverage: runs and prints the coverage reportng test --include <file>: runs a single spec filepnpm build,pnpm lint,pnpm format:check: pass🤖 Generated with Claude Code