-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
56 lines (48 loc) · 1.8 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 {
files,
getFileName,
} = require('./packages/bundler-webpack/lib/requireHook');
const webpackModuleNameMapper = files.reduce((memo, file) => {
const fileName = getFileName(file);
memo[`^${file}$`] = `@umijs/deps/compiled/webpack/${fileName}`;
return memo;
}, {});
module.exports = {
// disable css files mock for bundler-webpack's css import tests
moduleNameMapper: {
// terser-webpack-plugin
'^webpack$': '@umijs/deps/compiled/webpack',
...webpackModuleNameMapper,
},
transformIgnorePatterns: ['/node_modules/(?!.*@babel)[^/]+?/'],
collectCoverageFrom(memo) {
return memo.concat([
// benchmarks
'!benchmarks/**/*',
// bundler-webpack
'!packages/bundler-webpack/src/getConfig/setPublicPath.ts',
'!packages/bundler-webpack/src/getConfig/runtimePublicPathEntry.ts',
'!packages/bundler-webpack/src/webpackHotDevClient/*',
'!packages/bundler-webpack/src/webpack/**/*',
'!packages/bundler-webpack/src/DevCompileDonePlugin.ts',
// preset-built-in
'!packages/preset-built-in/src/plugins/commands/config/*',
'!packages/preset-built-in/src/plugins/commands/help/*',
'!packages/preset-built-in/src/plugins/commands/plugin/*',
// utils
'!packages/utils/src/cleanRequireCache/cleanRequireCache.ts',
'!packages/utils/src/ssr/ssr.ts',
// test-utils
'!packages/test-utils/src/**/*',
// cli 入口不测
'!packages/bundler-webpack/src/cli.ts',
'!packages/umi/src/cli.ts',
'!packages/umi/src/forkedDev.ts',
'!packages/umi/src/ServiceWithBuiltIn.ts',
'!packages/umi/src/utils/fork.ts',
'!packages/create-umi-app/src/cli.ts',
// dev 在 fork 出来的子进程下,测不了
'!packages/preset-built-in/src/plugins/commands/dev/**/*',
]);
},
};