-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjest.config.js
56 lines (51 loc) · 1.96 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
const { join } = require('path');
require('dotenv').config({ path: join(__dirname, '.env.test') });
const mod = process.env.MODULE;
const config = {
verbose: true,
silent: process.env.CI && !mod,
testTimeout: 600000,
testEnvironment: 'node',
testRegex: '/__tests__/[a-z]+/.*\\.(test|spec)\\.(js|ts)$',
// 由于测试账号没有备案域名,所以线上 CI 忽略 CDN 测试
testPathIgnorePatterns: [
'/node_modules/',
'/__tests__/cdn/',
'/__tests__/apigw/custom-domains.test.ts',
'/__tests__/scf/special.test.ts', // 专门用来验证测试小地域功能发布测试
'/__tests__/scf/image.test.ts', // 专门用来验证测试镜像函数
'/__tests__/scf/http.test.ts', // 专门用来验证测试 HTTP 直通
'/__tests__/triggers/mps.test.ts',
'/__tests__/triggers/manager.test.ts',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
};
if (mod) {
config.testPathIgnorePatterns = ['/node_modules/', '/__tests__/apigw/custom-domains.test.ts'];
if (mod === 'custom-domains') {
config.testRegex = `/__tests__/apigw/custom-domains.test.(js|ts)`;
} else {
if (mod.indexOf('.') !== -1) {
const [moduleName, subModuleName] = mod.split('.');
config.testRegex = `/__tests__/${moduleName}/${subModuleName}.test.(js|ts)`;
} else {
config.testRegex = `/__tests__/${process.env.MODULE}/.*.test.(js|ts)`;
}
if (mod === 'scf') {
config.testPathIgnorePatterns = [
'/node_modules/',
'/__tests__/scf/special.test.ts', // 专门用来验证测试小地域功能发布测试
'/__tests__/scf/image.test.ts', // 专门用来验证测试镜像函数
'/__tests__/scf/http.test.ts', // 专门用来验证测试 HTTP 直通];
];
}
if (mod === 'triggers') {
config.testPathIgnorePatterns = [
'/node_modules/',
'/__tests__/triggers/mps.test.ts',
'/__tests__/triggers/manager.test.ts',
];
}
}
}
module.exports = config;