-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
80 lines (79 loc) · 1.67 KB
/
jest.config.js
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
const commonSettings = {
preset: 'ts-jest',
moduleFileExtensions: [
'js',
'json',
'vue',
'ts',
],
transform: {
'^.+\\.vue$': '@vue/vue3-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
},
transformIgnorePatterns: [
'/node_modules/',
],
moduleNameMapper: {
'^@src/(.*)$': '<rootDir>/src/$1',
'^@test/(.*)$': '<rootDir>/tests/$1',
},
testEnvironmentOptions: {
customExportConditions: [ 'node', 'node-addons' ],
},
};
module.exports = {
testEnvironmentOptions: {
url: 'http://localhost/',
},
globals: {
'ts-jest': {
babelConfig: true,
isolatedModules: true,
tsconfig: false,
},
},
coverageReporters: [ 'cobertura' ],
projects: [
{
...commonSettings,
displayName: 'components',
testEnvironment: 'jsdom',
testMatch: [
// TODO Move the FormData initialization out of the store, so they don't rely on a browser environment
'**/tests/unit/components/**/*.spec.(js|ts)',
],
snapshotSerializers: [
'jest-serializer-vue',
],
setupFilesAfterEnv: [
'./jest.setup.ts',
'./jest.dom.ts',
],
},
{
...commonSettings,
displayName: 'store',
testEnvironment: 'jsdom',
testMatch: [
// TODO Move the FormData initialization out of the store, so they don't rely on a browser (jsdom) environment
'**/tests/unit/store/**/*.spec.(js|ts)',
],
setupFilesAfterEnv: [
'./jest.setup.ts',
'./jest.dom.ts',
],
},
{
...commonSettings,
displayName: 'node',
testEnvironment: 'node',
testMatch: [
'**/tests/unit/*.spec.(js|ts)',
'**/tests/unit/utils/**/*.spec.(js|ts)',
],
setupFilesAfterEnv: [
'./jest.setup.ts',
],
},
],
};