refactor: 对齐 MetonaEditor — babel-jest 替代 ts-jest
CI / test (18.x) (push) Successful in 9m50s
CI / test (20.x) (push) Successful in 9m49s
CI / test (22.x) (push) Successful in 9m56s
CI / test (24.x) (push) Successful in 9m55s

### Changed
- 测试框架: ts-jest → babel-jest (对齐 MetonaEditor 生产方案)
- jest.config.cjs: babel-jest transform + moduleNameMapper
- test 脚本: jest → jest --coverage (对齐 MetonaEditor)
- 移除 ts-jest, 新增 @babel/core/preset-env/preset-typescript/babel-jest

### Added
- babel.config.cjs (对齐 MetonaEditor)

### Fixed
- 恢复 tslib (@rollup/plugin-typescript 必需依赖)

### Verified
- tsc --noEmit: 零错误
- jest --no-coverage: 136/136 passed
- rollup build: 5 outputs
This commit is contained in:
tianhao
2026-07-25 11:52:01 +08:00
parent 32a3bdf86e
commit cca2675fb4
4 changed files with 1491 additions and 183 deletions
+1 -14
View File
@@ -1,20 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
transform: {
'^.+\\.ts$': ['ts-jest', {
tsconfig: {
target: 'ES2020',
module: 'ESNext',
moduleResolution: 'node',
esModuleInterop: true,
strict: true,
lib: ['ES2020', 'DOM', 'DOM.Iterable'],
allowImportingTsExtensions: true,
noEmit: true,
},
}],
'^.+\\.ts$': 'babel-jest',
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',