微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NWL NX Angular Jest 测试报告“无法找到描述”错误

如何解决NWL NX Angular Jest 测试报告“无法找到描述”错误

有谁知道为什么我的 Angular Jest 测试报告: error TS2593: Cannot find name 'describe’. ??

我有一个运行 Angular 应用程序和多个库的 NWL NX 工作区。

所有中的测试运行良好。 应用中的测试都报告了这个错误。 我没有编辑配置 - 所以这些应该是 NX 设置中的配置。 我该如何解决??有什么想法吗?

应用 TsConfig: // 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"],"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": {
  },

不知道为什么。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。