Files
pn-new-crm/vitest.config.ts

39 lines
1.2 KiB
TypeScript
Raw Normal View History

import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import path from 'path';
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { loadEnv } = require('vite');
export default defineConfig({
// Next.js tsconfig sets jsx: 'preserve' so .tsx files imported by
// tests (e.g. react-email templates) aren't transformed by vite's
// default loader. The official react plugin handles the JSX
// transform in test-time only — Next's runtime keeps its preserve
// setting for the prod build.
plugins: [react()],
test: {
globals: true,
environment: 'node',
include: [
'tests/unit/**/*.test.ts',
'tests/unit/**/*.test.tsx',
'tests/integration/**/*.test.ts',
'tests/integration/**/*.test.tsx',
],
exclude: ['tests/e2e/**', 'node_modules/**'],
pool: 'forks',
globalSetup: ['./tests/global-setup.ts'],
coverage: {
provider: 'v8',
reporter: ['text', 'lcov', 'json-summary'],
include: ['src/lib/**'],
exclude: ['src/lib/db/migrations/**', 'src/lib/db/schema/**', 'src/**/*.d.ts'],
},
testTimeout: 30_000,
env: loadEnv('test', process.cwd(), ''),
},
resolve: {
alias: { '@': path.resolve(__dirname, './src') },
},
});