-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.conffig.js
46 lines (44 loc) · 1.15 KB
/
jest.conffig.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
const path = require("path");
module.exports = {
rootDir: path.resolve(__dirname),
clearMocks: true,
coverageDirectory: "coverage",
coverageProvider: "v8",
moduleFileExtensions: ["vue", "js", "json", "jsx", "ts", "tsx", "node"],
// 别名
moduleNameMapper: {
"@/(.*)$": "<rootDir>/src/components/$1",
},
preset: "ts-jest",
testEnvironment: "jsdom",
// 测试
testMatch: ["<rootDir>/src/__tests__/**/*.spec.(ts|tsx|js)"],
testPathIgnorePatterns: ["/node_modules/", "/stories/"],
moduleFileExtensions: ["js", "json", "ts", "tsx"],
transform: {
"^.+\\.vue$": "vue-jest",
"\\.scss$": "jest-transform-css",
"^.+\\.(ts|tsx|js|jsx)$": [
"babel-jest",
{
presets: [
["@babel/preset-env", { targets: { node: true } }],
"@vue/babel-preset-jsx",
"@babel/preset-typescript",
],
plugins: [
[
"@vue/babel-plugin-jsx",
{ mergeProps: false, enableObjectSlots: false },
],
[
"@babel/plugin-proposal-decorators",
{
legacy: true,
},
],
],
},
],
},
};