-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvitest.config.ts
More file actions
62 lines (59 loc) · 1.83 KB
/
Copy pathvitest.config.ts
File metadata and controls
62 lines (59 loc) · 1.83 KB
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
55
56
57
58
59
60
61
62
// Ensure consistent date handling in tests regardless of host timezone
process.env.TZ = 'UTC';
import { defineConfig, coverageConfigDefaults } from 'vitest/config';
import { loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ mode }) => {
const env = loadEnv(mode ?? 'test', process.cwd(), '');
return {
plugins: [react()],
resolve: {
alias: [
{ find: /^next-i18next$/, replacement: 'react-i18next' },
{ find: 'next/router', replacement: 'next-router-mock' },
{ find: 'next/dist/client/router', replacement: 'next-router-mock' },
],
},
test: {
globals: true,
environment: 'jsdom',
env,
setupFiles: ['./src/setupTests.ts', 'fake-indexeddb/auto'],
reporters: ['verbose', 'junit'],
outputFile: {
junit: './jest-report.xml',
},
css: {
modules: {
classNameStrategy: 'non-scoped',
},
},
coverage: {
include: ['src/**/*.{js,jsx,ts,tsx}'],
exclude: [
...coverageConfigDefaults.exclude,
'scripts/**',
'src/pages/404.tsx',
'src/pages/_app.tsx',
'src/pages/_document.tsx',
'src/pages/_error.tsx',
'src/pages/callback.tsx',
'src/pages/api/healthz.ts',
'src/pages/api/readiness.ts',
'src/tests/',
'src/common/components/menuDropdown/menu/Menu.tsx',
'src/utils/getPageHeaderHeight.ts',
'src/utils/getSessionAndUser.ts',
'src/utils/mockDataUtils.ts',
'src/utils/mockSession.ts',
'src/utils/testUtils.ts',
'constants.ts',
'types.ts',
],
reporter: ['clover', 'json', 'lcov', 'text', 'cobertura'],
provider: 'istanbul',
},
testTimeout: 1000000,
},
};
});