2023-12-25 17:45:12 +08:00
|
|
|
import react from '@vitejs/plugin-react-swc';
|
|
|
|
|
import svgr from 'vite-plugin-svgr';
|
|
|
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
2024-03-19 18:17:52 +08:00
|
|
|
import { configDefaults, defineConfig } from 'vitest/config';
|
2023-12-25 17:45:12 +08:00
|
|
|
|
|
|
|
|
const testFiles = ['./src/**/*.{test,spec}.{js,jsx,ts,tsx}'];
|
|
|
|
|
export default defineConfig({
|
2026-02-11 12:28:13 +08:00
|
|
|
resolve: {
|
|
|
|
|
conditions: ['@teable/source'],
|
|
|
|
|
},
|
|
|
|
|
ssr: {
|
|
|
|
|
resolve: {
|
|
|
|
|
conditions: ['@teable/source'],
|
|
|
|
|
externalConditions: ['@teable/source'],
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-12-25 17:45:12 +08:00
|
|
|
plugins: [
|
|
|
|
|
react({
|
|
|
|
|
devTarget: 'es2022',
|
|
|
|
|
}),
|
|
|
|
|
tsconfigPaths(),
|
|
|
|
|
svgr({
|
|
|
|
|
// svgr options: https://react-svgr.com/docs/options/
|
|
|
|
|
svgrOptions: {},
|
|
|
|
|
}),
|
|
|
|
|
],
|
2024-03-19 16:44:33 +08:00
|
|
|
cacheDir: '../../.cache/vitest/nextjs-app',
|
2023-12-25 17:45:12 +08:00
|
|
|
test: {
|
|
|
|
|
globals: true,
|
|
|
|
|
environment: 'happy-dom',
|
|
|
|
|
passWithNoTests: false,
|
|
|
|
|
setupFiles: './config/tests/setupVitest.ts',
|
|
|
|
|
coverage: {
|
|
|
|
|
provider: 'v8',
|
2026-01-14 18:16:25 +08:00
|
|
|
include: ['src/**/*.{js,jsx,ts,tsx}', 'config/**/*.{js,jsx,ts,tsx}'],
|
2023-12-25 17:45:12 +08:00
|
|
|
},
|
|
|
|
|
include: testFiles,
|
2024-03-19 18:17:52 +08:00
|
|
|
exclude: [...configDefaults.exclude, '**/.next/**'],
|
2023-12-25 17:45:12 +08:00
|
|
|
},
|
|
|
|
|
});
|