forked from belgattitude/nextjs-monorepo-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvitest.config.ts
54 lines (52 loc) · 1.45 KB
/
vitest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
const testFiles = ['./src/**/*.test.{js,jsx,ts,tsx}'];
export default defineConfig({
plugins: [
react({
jsxImportSource: '@emotion/react',
babel: {
plugins: ['@emotion/babel-plugin'],
},
}),
tsconfigPaths(),
svgr({
// Set it to `true` to export React component as default.
// Notice that it will override the default behavior of Vite.
exportAsDefault: true,
// svgr options: https://react-svgr.com/docs/options/
svgrOptions: {},
}),
],
test: {
globals: true,
environment: 'happy-dom',
passWithNoTests: false,
setupFiles: './config/tests/setupVitest.ts',
cache: {
dir: '../../.cache/vitest/nextjs-app',
},
coverage: {
provider: 'v8',
reporter: ['text', 'clover'],
extension: ['js', 'jsx', 'ts', 'tsx'],
},
include: testFiles,
// you might want to disable it, if you don't have tests that rely on CSS
// since parsing CSS is slow
css: true,
// To mimic Jest behaviour regarding mocks.
// @link https://vitest.dev/config/#clearmocks
clearMocks: true,
mockReset: true,
restoreMocks: true,
exclude: [
'**/node_modules/**',
'**/dist/**',
'**/.next/**',
'**/.{idea,git,cache,output,temp}/**',
],
},
});