forked from opensumi/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
73 lines (71 loc) · 2.52 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
72
73
const { pathsToModuleNameMapper } = require('ts-jest');
const tsconfig = require('./configs/ts/tsconfig.resolve.json');
const os = require('os');
const tsModuleNameMapper = pathsToModuleNameMapper(tsconfig.compilerOptions.paths, { prefix: '<rootDir>/configs/' });
module.exports = {
preset: 'ts-jest',
testRunner: 'jest-jasmine2',
testEnvironment: 'node',
coverageProvider: process.env.JEST_COVERAGE_PROVIDER || 'babel',
maxWorkers: process.env.SIGMA_MAX_PROCESSORS_LIMIT || os.cpus().length,
setupFiles: ['./jest.setup.js'],
collectCoverageFrom: [
'packages/*/src/**/*.ts',
'!packages/**/*.contribution.ts',
// 部分contribution文件为-contribution结尾
'!packages/**/*-contribution.ts',
'!packages/startup/**/*.ts',
// Test 功能暂未完成
'!packages/testing/**/*.ts',
// CLI 不需要测试
'!packages/remote-cli/**/*.ts',
'!packages/core-electron-main/**/*.ts',
'!packages/*/src/electron-main/**/*.ts',
],
moduleNameMapper: {
...tsModuleNameMapper,
'.*\\.(css|less)$': '<rootDir>/tools/dev-tool/src/mock-exports.js',
},
testPathIgnorePatterns: [
'/dist/',
'/packages/feature-extension/test/fixture/',
'/packages/vscode-extension/test/fixture/',
'/tools/workspace/',
'/tools/extensions/',
'/tools/candidate-ext/',
'/packages/status-bar/entry',
'/packages/startup/entry',
'/packages/quick-open/entry',
// 终端渲染测试暂时不跟随单元测试
'/packages/terminal-next/__tests__/browser/render.test.ts',
// ci 环境可能无法正常创建 pty 后端,需要 mock 一下 service
// '/packages/terminal-next/__tests__/browser/client.test.ts',
// componets下的 utils 均引用自 @opensumi/ide-core-common 模块,无须重复测试
// 后续统一至 @opensumi/ide-utils 模块
'/packages/components/src/utils',
],
modulePathIgnorePatterns: ['<rootDir>/dist/'],
coveragePathIgnorePatterns: [
'/dist/',
'/node_modules/',
'/__test__/',
'/mocks/',
'/tools/template/',
'/tools/workspace/',
'/packages/status-bar/entry',
'/packages/startup/entry',
'/packages/quick-open/entry',
// componets下的 utils 均引用自 @opensumi/ide-core-common 模块,无须重复测试
// 后续统一至 @opensumi/ide-utils 模块
'/packages/components/src/utils',
],
testMatch: ['**/__tests__/**/*.test.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
};