-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
59 lines (48 loc) · 1.5 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
const { jsWithBabel: preset } = require('ts-jest/presets');
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig.test.json');
module.exports = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['**/src/**/*.{[tj]s?(x),vue}'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['/node_modules/', '<rootDir>/src/main.js'],
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
moduleFileExtensions: ['tsx', 'ts', 'js', 'jsx', 'json', 'vue'],
moduleNameMapper: {
'\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)$':
'<rootDir>/test/__mocks__/file.js',
'vuex-router-sync':
'<rootDir>/node_modules/vuex-router-sync/dist/vuex-router-sync.cjs.js',
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
},
snapshotSerializers: ['jest-serializer-vue'],
testMatch: ['**/test/**/?(*.)+(spec|test).[tj]s?(x)'],
transform: {
...preset.transform,
'^.+\\.(vue)$': 'vue-jest',
},
globals: {
'ts-jest': {
tsconfig: {
lib: ['ES2019', 'DOM'],
target: 'ES2019',
module: 'commonjs',
},
},
'vue-jest': {
pug: {
doctype: 'html',
},
},
},
};