Implementation:Cypress io Cypress Vitest Config
| Knowledge Sources | |
|---|---|
| Domains | Testing, Development |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
Concrete Vitest configuration for running unit tests across the Cypress monorepo with per-package configs aggregated at the root level.
Description
The root vitest.config.ts (L1-17) uses Vitest's workspace feature to aggregate all per-package configurations. It defines test.projects pointing to all package-level vitest configs ({packages,tooling,scripts}/*/vitest.config.{ts,mjs}). V8 coverage provider generates clover-format reports.
Usage
Run vitest from the repository root for the full test suite, or from a specific package directory for package-level tests.
Code Reference
Source Location
- Repository: cypress-io/cypress
- File: vitest.config.ts
- Lines: L1-17
Signature
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
projects: [
'{packages,tooling,scripts}/*/vitest.config.{ts,mjs}',
'cli/vitest.config.*',
],
coverage: {
provider: 'v8',
reporter: ['clover'],
},
reporters: ['default', 'junit'],
},
})
Import
# Run all tests
npx vitest
# Run with coverage
npx vitest --coverage
# Run specific package tests
npx vitest --project @packages/config
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Test files | *.spec.ts | Yes | Test specification files across packages |
| Per-package configs | vitest.config.ts | Yes | Package-level Vitest configurations |
Outputs
| Name | Type | Description |
|---|---|---|
| Test results | stdout | Pass/fail counts per package |
| JUnit XML | file | JUnit report for CI integration |
| Coverage report | clover XML | V8 code coverage in clover format |
Usage Examples
Running Tests
# Run full test suite
npx vitest
# Run in watch mode during development
npx vitest --watch
# Run with coverage
npx vitest --coverage
# Run specific package
cd packages/config && npx vitest