-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
31 lines (30 loc) · 1.19 KB
/
Copy pathjest.config.js
File metadata and controls
31 lines (30 loc) · 1.19 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
const path = require('path');
module.exports = {
rootDir: path.resolve(__dirname, './'),
silent: false,
verbose: true,
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'vue'], // 处理这些文件
moduleDirectories: ['node_modules', 'assets'], // 从这些目录去查找资源
moduleNameMapper: { // 解析文件路径, identity-obj-proxy是模拟输入
'^@/(.*)$': '<rootDir>/assets',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'identity-obj-proxy',
'\\.(css|less|scss)$': 'identity-obj-proxy'
},
transform: { // 可以理解成loader
'^.+\\.js$': 'babel-jest',
'.*\\.(vue)$': 'vue-jest'
},
transformIgnorePatterns: ['<rootDir>/node_modules/'],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/projects/'
],
testRegex: '(/test/.*)\\.test\\.js$', // 测试文件匹配模式
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'], // 快照的序列化工具
collectCoverage: false, // 测试覆盖率
coverageDirectory: '<rootDir>/test/coverage',
collectCoverageFrom: [ // 测试覆盖率
'<rootDir>/test/testDemo/**/*.{js,vue}',
'!**/node_modules/**'
]
};