Unit Test Protocol
Framework Detection
Never assume Jest or Vitest. Detect first:
- Check imports in test files
- Check config:
vitest.config.*,jest.config.* - Check
package.jsondependencies (workspace-specific in monorepos) - Grep test scripts in package.json
Running Tests
Run relevant tests only unless explicitly requested:
pnpm run test path/to/file.test.ts
# monorepo: cd apps/demo-app && pnpm run test path/to/file.test.ts
For all tests, use test script in closest package.json:
pnpm run test
# monorepo: cd apps/demo-app && pnpm run test