【问题标题】:NWL NX Angular Jest tests are reporting "unable to find describe" errorsNWL NX Angular Jest 测试报告“无法找到描述”错误
【发布时间】:2021-04-27 02:08:50
【问题描述】:

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

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

所有 Libs 中的测试运行良好。 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"]
}

【问题讨论】:

    标签: angular typescript jestjs tsconfig angular-test


    【解决方案1】:

    所以这对我不起作用:

    "compilerOptions": {
        "typeRoots": ["node_modules/@types"],
        "types" : ["node", "jest"],
      },
    

    但是这样做了:???

    "compilerOptions": {
      },
    

    不知道为什么。

    【讨论】:

      猜你喜欢
      • 2022-08-23
      • 2021-06-07
      • 2016-12-25
      • 1970-01-01
      • 2021-01-16
      • 2018-08-21
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      相关资源
      最近更新 更多