33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
|
|
import { fileURLToPath, URL } from 'node:url';
|
||
|
|
|
||
|
|
import react from '@vitejs/plugin-react';
|
||
|
|
import { defineConfig } from 'vite';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Separate from vite.config.ts on purpose: the app's build config knows
|
||
|
|
* nothing about a test runner, and vitest's `test` block is not a valid Vite
|
||
|
|
* option, so mixing them makes `vite build` warn about an unknown key.
|
||
|
|
*/
|
||
|
|
export default defineConfig({
|
||
|
|
plugins: [react()],
|
||
|
|
resolve: {
|
||
|
|
// Mirrors the "@/*" path mapping in tsconfig.json.
|
||
|
|
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
|
||
|
|
},
|
||
|
|
test: {
|
||
|
|
environment: 'jsdom',
|
||
|
|
setupFiles: ['./src/test/setup.ts'],
|
||
|
|
css: false,
|
||
|
|
// e2e/ holds Playwright specs (a different `test()` global), and
|
||
|
|
// contract/ hits the live stack over the network - neither belongs in
|
||
|
|
// the hermetic default run. See vitest.contract.config.ts for the latter.
|
||
|
|
exclude: ['node_modules/**', 'e2e/**', 'contract/**'],
|
||
|
|
coverage: {
|
||
|
|
provider: 'v8',
|
||
|
|
reporter: ['text', 'text-summary'],
|
||
|
|
include: ['src/**/*.{ts,tsx}'],
|
||
|
|
exclude: ['src/main.tsx', 'src/vite-env.d.ts', 'src/**/*.d.ts'],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|