Skip to content

Commit 632dd57

Browse files
authored
Merge pull request #173 from VisActor/chore/update-jest
chore: update jest to 0.29
2 parents 82105be + 4d880c9 commit 632dd57

File tree

16 files changed

+1640
-3078
lines changed

16 files changed

+1640
-3078
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 1455 additions & 2954 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/calculator/jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const path = require('path');
2+
const baseJestConfig = require('@internal/jest-config/jest.base');
3+
4+
module.exports = {
5+
...baseJestConfig,
6+
moduleNameMapper: {
7+
...baseJestConfig.moduleNameMapper
8+
}
9+
};

packages/calculator/jest.config.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/calculator/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,17 @@
3232
"@visactor/vutils": "~0.17.4"
3333
},
3434
"devDependencies": {
35-
"@types/jest": "^26.0.0",
35+
"@internal/jest-config": "workspace:*",
36+
"@types/jest": "~29.5.0",
37+
"jest": "~29.5.0",
38+
"jest-environment-jsdom": "~29.5.0",
39+
"@jest/globals": "~29.5.0",
40+
"ts-jest": "~29.2.5",
3641
"@typescript-eslint/eslint-plugin": "5.30.0",
3742
"@typescript-eslint/parser": "5.30.0",
3843
"@types/node": "*",
39-
"jest": "^26.0.0",
4044
"npm-run-all": "^4.1.5",
4145
"rimraf": "^3.0.2",
42-
"ts-jest": "^26.0.0",
4346
"ts-node": "10.9.0",
4447
"typescript": "4.9.5",
4548
"@internal/ts-config": "workspace:*",

packages/chart-advisor/jest.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const path = require('path');
2+
const baseJestConfig = require('@internal/jest-config/jest.base');
3+
4+
module.exports = {
5+
...baseJestConfig,
6+
moduleNameMapper: {
7+
...baseJestConfig.moduleNameMapper
8+
}
9+
};

packages/chart-advisor/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@
3333
"@visactor/vutils": "~0.17.4"
3434
},
3535
"devDependencies": {
36-
"@types/jest": "^26.0.0",
36+
"@internal/jest-config": "workspace:*",
37+
"@types/jest": "~29.5.0",
38+
"jest": "~29.5.0",
39+
"jest-environment-jsdom": "~29.5.0",
40+
"@jest/globals": "~29.5.0",
41+
"ts-jest": "~29.2.5",
3742
"@types/node": "*",
38-
"jest": "^26.0.0",
39-
"ts-jest": "^26.0.0",
4043
"typescript": "4.9.5",
4144
"undici-types": "^5.27.2",
4245
"@typescript-eslint/eslint-plugin": "5.30.0",

packages/vmind/__tests__/performance/performanceTest.ts renamed to packages/vmind/__tests__/performance/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const testPerformance = (model: Model, vmind: VMind) => {
8585
} else {
8686
error('fail to generate with LLM!');
8787
}
88-
done();
88+
// done();
8989
});
9090
}
9191
modelResultMap[model].totalCount += 1;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "@internal/ts-config/tsconfig.base.json",
3+
"include": ["./", "../src"],
4+
"compilerOptions": {
5+
"paths": {
6+
"@visactor/calculator": ["../../calculator/src"],
7+
"@visactor/chart-advisor": ["../../chart-advisor/src"]
8+
},
9+
"lib": ["DOM", "ESNext"]
10+
},
11+
"references": []
12+
}

packages/vmind/jest.config.js

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
1+
const path = require('path');
2+
const baseJestConfig = require('@internal/jest-config/jest.base');
3+
14
module.exports = {
2-
preset: 'ts-jest',
3-
runner: 'jest-electron/runner',
4-
testEnvironment: 'jest-electron/environment',
5-
testMatch: ['<rootDir>/__tests__/unit/**/*.test.(js|ts)'],
6-
silent: true,
7-
globals: {
8-
'ts-jest': {
9-
isolatedModules: true,
10-
resolveJsonModule: true,
11-
esModuleInterop: true,
12-
experimentalDecorators: true,
13-
module: 'ESNext',
14-
tsconfig: './tsconfig.test.json'
15-
}
16-
},
17-
verbose: true,
18-
collectCoverage: true,
19-
coverageReporters: ['json-summary', 'lcov', 'text'],
20-
coveragePathIgnorePatterns: ['node_modules', '__tests__', 'interface.ts', '.d.ts', 'typings', 'vite'],
21-
collectCoverageFrom: [
22-
'**/src/**',
23-
'!**/cjs/**',
24-
'!**/build/**',
25-
'!**/esm/**',
26-
'!**/node_modules/**',
27-
'!**/__tests__/**',
28-
'!**/types/**',
29-
'!**/interface.ts',
30-
'!**/vite/**'
31-
]
5+
...baseJestConfig,
6+
moduleNameMapper: {
7+
...baseJestConfig.moduleNameMapper
8+
}
329
};
Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,37 @@
1+
const path = require('path');
2+
const baseJestConfig = require('@internal/jest-config/jest.base');
3+
14
module.exports = {
2-
preset: 'ts-jest',
3-
silent: false,
4-
globals: {
5-
'ts-jest': {
6-
resolveJsonModule: true,
7-
esModuleInterop: true,
8-
experimentalDecorators: true,
9-
module: 'ESNext',
10-
tsconfig: './tsconfig.test.json'
11-
}
12-
},
13-
testTimeout: 60000,
5+
...baseJestConfig,
146
moduleNameMapper: {
15-
axios: 'axios/dist/node/axios.cjs',
16-
'd3-hierarchy': 'd3-hierarchy/dist/d3-hierarchy.min.js',
17-
'^src/(.*)$': '<rootDir>/src/$1',
7+
...baseJestConfig.moduleNameMapper,
8+
axios: path.resolve(__dirname, 'node_modules/axios/dist/node/axios.cjs')
189
},
1910
verbose: true,
2011
// 在测试之前设置环境变量
21-
setupFiles: ['./test-setup.js'],
22-
testEnvironment: 'node'
12+
setupFiles: ['./test-setup.js']
2313
};
14+
15+
// module.exports = {
16+
// preset: 'ts-jest',
17+
// silent: false,
18+
// globals: {
19+
// 'ts-jest': {
20+
// resolveJsonModule: true,
21+
// esModuleInterop: true,
22+
// experimentalDecorators: true,
23+
// module: 'ESNext',
24+
// tsconfig: './tsconfig.test.json'
25+
// }
26+
// },
27+
// testTimeout: 60000,
28+
// moduleNameMapper: {
29+
// axios: 'axios/dist/node/axios.cjs',
30+
// 'd3-hierarchy': 'd3-hierarchy/dist/d3-hierarchy.min.js',
31+
// '^src/(.*)$': '<rootDir>/src/$1'
32+
// },
33+
// verbose: true,
34+
// // 在测试之前设置环境变量
35+
// setupFiles: ['./test-setup.js'],
36+
// testEnvironment: 'node'
37+
// };

0 commit comments

Comments
 (0)