Repository navigation
Expand file tree
/
Copy pathvitest.config.mts
More file actions
82 lines (79 loc) · 2.16 KB
/
Copy pathvitest.config.mts
File metadata and controls
82 lines (79 loc) · 2.16 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import tokensBabelPlugin from '@atlaskit/tokens/babel-plugin';
import compiled from '@compiled/vite-plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
export default defineConfig({
// pre-compile token() calls to literal CSS var strings so cssMap() can statically evaluate them
plugins: [
compiled({ transformerBabelPlugins: [tokensBabelPlugin] }),
react(),
],
test: {
globals: true,
// vmThreads' node:vm ESM/CJS interop breaks packages like react-router that ship
// an .mjs file inside a CommonJS package
pool: 'threads',
clearMocks: true,
onConsoleLog(log, type) {
// suppress noisy Atlaskit feature-gate/platform-feature-flags errors
if (
type === 'stderr' &&
typeof log === 'string' &&
log.includes('Client must be initialized before using this method')
) {
return false;
}
// suppress noisy i18next logs
if (
type === 'stdout' &&
typeof log === 'string' &&
log.includes('Locize')
) {
return false;
}
},
experimental: {
importDurations: {
print: true,
},
},
coverage: {
enabled: false,
reportOnFailure: true,
reporter: ['html', 'lcovonly'],
include: ['src/**/*'],
exclude: [
'**/*.html',
'**/*.graphql',
'**/graphql/generated/**',
'**/.DS_Store',
],
},
projects: [
{
extends: true,
test: {
name: 'happy-dom [preload, renderer]',
environment: 'happy-dom',
include: [
'src/preload/**/*.test.{ts,tsx}',
'src/renderer/**/*.test.{ts,tsx}',
],
setupFiles: ['./src/renderer/__helpers__/vitest.setup.ts'],
},
},
{
// TODO - Opportunity in future to move some of the renderer util tests to node environment
extends: true,
test: {
name: 'node [main, shared]',
environment: 'node',
include: [
'src/shared/**/*.test.{ts,tsx}',
'src/main/**/*.test.{ts,tsx}',
],
},
},
],
},
});