NWL NX Angular Jest 测试报告 "unable to find describe" 错误
NWL NX Angular Jest tests are reporting "unable to find describe" errors
有谁知道为什么我的 Angular Jest 测试报告:
error TS2593: Cannot find name 'describe’.
??
我有一个 NWL NX 工作区 运行 一个 Angular 应用程序和多个库。
所有 库 中的测试 运行 都很好。
App中的测试都报这个错。
我没有编辑配置 - 所以这些应该是来自 NX 设置的配置。
我该如何解决??有什么想法吗?
应用 TsConfigs:
// tsconfig.json
{
"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"],
"types" : ["node"],
},
"files": ["src/main.ts", "src/polyfills.ts"]
}
// tsconfig.spec.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
所以这对我不起作用:
"compilerOptions": {
"typeRoots": ["node_modules/@types"],
"types" : ["node", "jest"],
},
但是这样做了:???
"compilerOptions": {
},
不知道为什么。
有谁知道为什么我的 Angular Jest 测试报告:
error TS2593: Cannot find name 'describe’.
??
我有一个 NWL NX 工作区 运行 一个 Angular 应用程序和多个库。
所有 库 中的测试 运行 都很好。 App中的测试都报这个错。 我没有编辑配置 - 所以这些应该是来自 NX 设置的配置。 我该如何解决??有什么想法吗?
应用 TsConfigs: // tsconfig.json
{
"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"],
"types" : ["node"],
},
"files": ["src/main.ts", "src/polyfills.ts"]
}
// tsconfig.spec.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
}
所以这对我不起作用:
"compilerOptions": {
"typeRoots": ["node_modules/@types"],
"types" : ["node", "jest"],
},
但是这样做了:???
"compilerOptions": {
},
不知道为什么。