Using Vitest with An Angular Project
Vitest can be added to any existing Angular project with a few steps.
Automated Setup Using a Schematic/Generator
Vitest can be installed and setup using a schematic/generator for Angular CLI or Nx workspaces.
First, install the @analogjs/vitest-angular package:
- npm
- Yarn
- pnpm
npm install @analogjs/vitest-angular --save-dev
yarn add @analogjs/vitest-angular --dev
pnpm install -w @analogjs/vitest-angular --save-dev
Next, run the schematic to set up the Vite config, test configuration files, and update the test configuration.
ng g @analogjs/vitest-angular:setup --project [your-project-name]