问题描述
有谁知道为什么我的 Angular Jest 测试报告:
error TS2593: Cannot find name 'describe’.
??
我有一个运行 Angular 应用程序和多个库的 NWL NX 工作区。
所有库中的测试运行良好。 应用中的测试都报告了这个错误。 我没有编辑配置 - 所以这些应该是 NX 设置中的配置。 我该如何解决??有什么想法吗?
{
"extends": "../../tsconfig.base.json","compilerOptions": {
"typeRoots": ["node_modules/@types"],"types" : ["node"],},"files": [],"include": [],"references": [
{
"path": "./tsconfig.app.json"
},{
"path": "./tsconfig.spec.json"
},{
"path": "./tsconfig.editor.json"
}
]
}
// tsconfig.app.json
{
"extends": "./tsconfig.json","compilerOptions": {
"outDir": "../../dist/out-tsc","typeRoots": ["node_modules/@types"],"files": ["src/main.ts","src/polyfills.ts"]
}
// tsconfig.spec.json
{
"extends": "./tsconfig.json","module": "commonjs","types": ["jest","node"]
},"files": ["src/test-setup.ts"],"include": ["**/*.spec.ts","**/*.d.ts"]
}
解决方法
所以这对我不起作用:
"compilerOptions": {
"typeRoots": ["node_modules/@types"],"types" : ["node","jest"],},
但这确实是:???
"compilerOptions": {
},
不知道为什么。