Skip to content

Commit 38be3de

Browse files
committed
chore: renderer jest config add collectCoverage
1 parent 2dfdba3 commit 38be3de

3 files changed

Lines changed: 22 additions & 5 deletions

File tree

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
1-
module.exports = {
1+
const fs = require('fs');
2+
const { join } = require('path');
3+
const esModules = ['zen-logger'].join('|');
4+
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
5+
6+
const jestConfig = {
27
// transform: {
38
// '^.+\\.[jt]sx?$': 'babel-jest',
49
// // '^.+\\.(ts|tsx)$': 'ts-jest',
510
// // '^.+\\.(js|jsx)$': 'babel-jest',
611
// },
12+
// testMatch: ['**/document/node/node.test.ts'],
13+
// testMatch: ['**/designer/builtin-hotkey.test.ts'],
14+
// testMatch: ['**/plugin/plugin-manager.test.ts'],
715
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
16+
transformIgnorePatterns: [
17+
`/node_modules/(?!${esModules})/`,
18+
],
819
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
920
collectCoverage: true,
1021
collectCoverageFrom: [
11-
'src/**/*.{ts,tsx}',
22+
'src/**/*.ts',
23+
'!src/**/*.d.ts',
1224
'!**/node_modules/**',
13-
'!**/vendor/**',
1425
],
1526
};
27+
28+
// 只对本仓库内的 pkg 做 mapping
29+
jestConfig.moduleNameMapper = {};
30+
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
31+
32+
module.exports = jestConfig;

packages/react-simulator-renderer/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const jestConfig = {
1818
],
1919
setupFiles: ['./test/utils/host.ts'],
2020
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
21-
collectCoverage: false,
21+
collectCoverage: true,
2222
collectCoverageFrom: [
2323
'src/**/*.ts',
2424
'!src/**/*.d.ts',

packages/renderer-core/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const jestConfig = {
1616
],
1717
setupFiles: ['./tests/fixtures/unhandled-rejection.ts'],
1818
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
19-
collectCoverage: false,
19+
collectCoverage: true,
2020
collectCoverageFrom: [
2121
'src/**/*.ts',
2222
'!src/**/*.d.ts',

0 commit comments

Comments
 (0)