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
+7 -4
View File
@@ -24,9 +24,8 @@
"scripts": {
"build": "tsc --noEmit && rollup -c",
"dev": "rollup -c -w",
"test": "jest",
"test": "jest --coverage",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "eslint 'src/**/*.ts' --fix",
"format": "prettier --write 'src/**/*.ts' 'tests/**/*.ts'",
@@ -57,6 +56,10 @@
},
"homepage": "https://git.metona.cn/MetonaTeam/MetonaToast#readme",
"devDependencies": {
"@babel/core": "^7.22.0",
"@babel/plugin-transform-modules-commonjs": "^7.22.0",
"@babel/preset-env": "^7.22.0",
"@babel/preset-typescript": "^7.22.0",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@rollup/plugin-terser": "^0.4.0",
@@ -64,6 +67,7 @@
"@types/jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"babel-jest": "^29.5.0",
"eslint": "^8.40.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
@@ -72,8 +76,7 @@
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-serve": "^2.0.1",
"ts-jest": "^29.4.12",
"tslib": "^2.8.1",
"tslib": "^2.6.0",
"typescript": "^5.0.0"
},
"engines": {