forked from Shyam-Chen/Vue-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
69 lines (65 loc) · 1.72 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
const env = require('./env');
switch (process.env.JEST_ENV) {
case 'app':
module.exports = {
coveragePathIgnorePatterns: [
'/node_modules/',
'/tools/',
],
moduleFileExtensions: ['js', 'vue'],
moduleNameMapper: {
'~assets(.*)': '<rootDir>/src/assets$1',
'~(.*)': '<rootDir>/src/app$1',
},
setupTestFrameworkScriptFile: '<rootDir>/tools/setup-app.js',
snapshotSerializers: [
'<rootDir>/node_modules/jest-serializer-vue',
],
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'.*\\.e2e-spec.js$',
],
testURL: `http://${env.HOST_NAME}/`,
transform: {
'^.+\\.js$': 'babel-jest',
'^.+\\.vue$': 'vue-jest',
'^[./a-zA-Z0-9$_-]+\\.(bmp|gif|jpg|jpeg|png|psd|svg|webp)$': '<rootDir>/tools/assets-transform.js',
},
};
break;
case 'api':
module.exports = {
coveragePathIgnorePatterns: [
'/node_modules/',
'/tools/',
],
moduleNameMapper: {
'~(.*)': '<rootDir>/src/api$1',
},
setupTestFrameworkScriptFile: '<rootDir>/tools/setup-api.js',
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'.*\\.e2e-spec.js$',
],
testURL: `http://${env.HOST_NAME}/`,
transform: {
'^.+\\.js$': 'babel-jest',
},
};
break;
case 'e2e':
module.exports = {
setupTestFrameworkScriptFile: '<rootDir>/tools/setup-e2e.js',
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'.*\\.spec.js$',
],
testURL: `http://${env.HOST_NAME}/`,
transform: {
'^.+\\.js$': 'babel-jest',
},
};
break;
default:
module.exports = {};
}