【发布时间】:2020-04-05 17:12:17
【问题描述】:
我在我的 Angular 应用程序中运行“npm run test”时遇到问题,控制台打印此消息“测试套件无法运行,Jest 遇到意外令牌”,我不知道为什么。
这是我在控制台中测试的结果:
Test Suites: 5 failed, 7 passed, 12 total
Tests: 24 passed, 24 total
Snapshots: 0 total
Time: 28.73s
这是我的设置:
babel.config.js:
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
'@babel/preset-typescript',
],
};
package.json:
"jest": {
"preset": "jest-preset-angular",
"setupTestFrameworkScriptFile": "./setupJest.ts",
"testPathIgnorePatterns": [
"./node_modules/",
"./src/test.ts"
],
【问题讨论】: