This repository has been archived by the owner on Dec 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
jest.config.js
71 lines (70 loc) · 1.94 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
const {
isMiniAppNativeTag,
removeCommentVnode,
transformAssetUrls,
} = require("./build/shared")
module.exports = async () => ({
preset: 'ts-jest',
rootDir: __dirname,
extensionsToTreatAsEsm: [".ts", ".json", ".vue"],
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'tsx', 'ts'],
transformIgnorePatterns: [],
testEnvironment: 'jsdom',
setupFilesAfterEnv: [
"<rootDir>/packages/test-utils/setupTests.ts"
],
transform: {
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.vue$': ['vue-jest', {
babelConfig: true,
tsconfig: 'jest.tsconfig.json',
template: {
transformAssetUrls,
compilerOptions: {
mode: 'module',
optimizeImports: true,
cacheHandlers: true,
comments: false,
isNativeTag: isMiniAppNativeTag,
nodeTransforms: [
removeCommentVnode,
function (node) {
if (node.type === 1 && node.tag.startsWith('at-')) {
node.tagType = 1
}
}
]
}
}
}],
},
snapshotSerializers: ['jest-serializer-vue'],
testMatch: [
'<rootDir>/packages/**/__tests__/*.spec.ts'
],
coverageDirectory: '<rootDir>/coverage',
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/packages/**/*.ts',
'<rootDir>/packages/**/*.vue',
'!<rootDir>/packages/*.d.ts',
'!<rootDir>/packages/utils/*.ts',
'!<rootDir>/packages/composables/*.ts',
'!<rootDir>/packages/types/*.ts',
'!<rootDir>/packages/test-utils/**/*.ts',
'!**/node_modules/**'
],
globals: {
'ts-jest': {
tsconfig: 'jest.tsconfig.json',
// work around: https://github.com/kulshekhar/ts-jest/issues/748#issuecomment-423528659
diagnostics: {
ignoreCodes: [151001],
}
}
},
maxConcurrency: 4,
roots: ['<rootDir>/packages/']
})