> @ test /home/projects/vitejs-vite-edm1pg
> cross-env TS_NODE_TRANSPILE_ONLY=yes jest --passWithNoTests
Error: Jest: Failed to parse the TypeScript config file /home/projects/vitejs-vite-edm1pg/jest.config.ts
TSError: ⨯ Unable to compile TypeScript:
error TS5095: Option 'bundler' can only be used when 'module' is set to 'preserve' or to 'es2015' or later.
at readConfigFileAndSetRootDir (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/jest-config@29.7.0_@types+node@22.7.5_ts-node@10.9.2/node_modules/jest-config/build/readConfigFileAndSetRootDir.js:116:13)
at async readInitialOptions (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/jest-config@29.7.0_@types+node@22.7.5_ts-node@10.9.2/node_modules/jest-config/build/index.js:403:13)
at async readConfig (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/jest-config@29.7.0_@types+node@22.7.5_ts-node@10.9.2/node_modules/jest-config/build/index.js:147:48)
at async readConfigs (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/jest-config@29.7.0_@types+node@22.7.5_ts-node@10.9.2/node_modules/jest-config/build/index.js:424:26)
at async runCLI (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/@jest+core@29.7.0_ts-node@10.9.2/node_modules/@jest/core/build/cli/index.js:151:59)
at async Object.run (/home/projects/vitejs-vite-edm1pg/node_modules/.pnpm/jest-cli@29.7.0_@types+node@22.7.5_ts-node@10.9.2/node_modules/jest-cli/build/run.js:130:37)
ELIFECYCLE Test failed. See above for more details.
What happens?
新建 umi simple app 后,使用
umi g jest
增加 jest 配置,无法运行 test。Mini Showcase Repository(REQUIRED)
https://stackblitz.com/edit/umi-edm1pg
How To Reproduce
Steps to reproduce the behavior:
pnpm create umi
生成 Simple Apppnpm umi g jest
配置使用 jestpnpm test
运行测试Expected behavior
Actual behavior
Temporary workaround:
src/.umi/tsconfig.json
中已设置"module": "esnext",
,注释掉"moduleResolution": "bundler",
后,测试可正常运行,但此时所有模块导出均错误。Context