Skip to content

chore: run tests with the Angular unit-test builder - #17

Merged
Garfield-fr merged 1 commit into
rero:mainfrom
Garfield-fr:chore/angular-unit-test-builder
Nov 24, 2026
Merged

Garfield-fr merged 1 commit into
rero:mainfrom
Garfield-fr:chore/angular-unit-test-builder

Conversation

@Garfield-fr

Copy link
Copy Markdown
Collaborator

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 testRunner schematic 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: the test target uses @angular/build:unit-test. The coverage settings from vite.config.mts (include, exclude, text and lcov reporters) moved here.
  • Scripts: test, test:watch and test:coverage keep their names and now call ng test. .ai/dev-commands.md is unchanged.
  • Removed: vite.config.mts, src/test-setup.ts, @analogjs/vite-plugin-angular and @analogjs/vitest-angular. The builder compiles the specs, resolves the @env/* and @shared/* aliases from tsconfig.json, and initializes TestBed (zoneless) itself. No spec used Analog's snapshot serializers.
  • tsconfig.spec.json: drops node from types. @types/node was only installed through Analog, and no spec uses Node APIs.
  • VS Code:
    • launch.json: the two test debug configurations now run ng 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:watch or the ng test launch configurations.

Checks

  • pnpm test: 22/22 tests pass
  • pnpm test:coverage: runs and prints the coverage report
  • ng test --include <file>: runs a single spec file
  • pnpm build, pnpm lint, pnpm format:check: pass
  • Manual: set a breakpoint in a spec and run ng test: current file in VS Code

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0bfb9dba-6465-40e3-860a-8dc43c9babe0
Commits

Reviewing files that changed from the base of the PR and between e1f7fbb and 2af87e0.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 7

  • .vscode/extensions.json
  • .vscode/launch.json
  • angular.json
  • package.json
  • src/test-setup.ts
  • tsconfig.spec.json
  • vite.config.mts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@Garfield-fr
Garfield-fr merged commit 3045650 into rero:main Nov 24, 2026
3 checks passed
@Garfield-fr
Garfield-fr deleted the chore/angular-unit-test-builder branch November 24, 2026 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant