Testing
Vitest
Unit and component testing with the Vite-native runner, configured per stack and wired into the app's tsconfig.
Supported frameworks
What create-faster adds
The Vite-native runner, configured for the kind of code each stack runs. React stacks get a jsdom environment with Testing Library; server stacks get a plain node environment.
Scripts (both variants):
test- Run the suite once (vitest run)test:watch- Watch mode (vitest)test:coverage- V8 coverage report (vitest run --coverage)
React stacks (Next.js, TanStack Start)
Dependencies
Files added:
vitest.config.ts # jsdom env, React + tsconfig-paths plugins
tests/
├── setup.ts # Imports @testing-library/jest-dom matchers
└── unit/
└── example.test.tsx # Sample component testimport react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [tsconfigPaths(), react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./tests/setup.ts'],
include: ['tests/{unit,integration}/**/*.{test,spec}.{ts,tsx}'],
},
});The include is scoped to tests/{unit,integration} so Vitest never picks up Playwright specs under tests/e2e. tests/setup.ts registers @testing-library/jest-dom/vitest, enabling matchers like toBeInTheDocument().
Modified files:
- TanStack Start
tsconfig.json- Addsteststoinclude(Next.js already covers it via**/*) so test files and the jest-dom matcher augmentation are type-checked.
Server stacks (Hono, Node)
Files added:
vitest.config.ts # node env, tsconfig-paths plugin
tests/
└── unit/
└── example.test.ts # Sample unit testimport tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
globals: true,
environment: 'node',
include: ['tests/{unit,integration}/**/*.{test,spec}.ts'],
},
});Modified files:
tsconfig.json(Hono and Node) - Addstests/**/*.tstoincludeso test files are type-checked alongsidesrc.
The @/* path alias resolves via vite-tsconfig-paths in both variants.

