【问题标题】:[Bug]: Cannot find module '@ngrx/effects/testing' after version updates[Bug]:版本更新后找不到模块“@ngrx/effects/testing”
【发布时间】:2022-01-08 20:14:57
【问题描述】:

我将项目从版本 25 迁移到 27,并且找不到更多模块“@ngrx/effects/testing”。在我的情况下,项目中的 baseUrl 设置为“./src”。在其他项目中,baseUrl 为“。”并且使用相同的笑话,角度,ngrx,测试运行没有问题。也许需要一些额外的配置来开玩笑?

这是我收到的消息:

Cannot find module '@ngrx/store/testing' from 'src/app/app.component.spec.ts'.

package.json 中的一些依赖项:

"dependencies": {
    "@angular/animations": "13.0.2",
    "@angular/common": "13.0.2",
    "@angular/core": "13.0.2",
    "@angular/forms": "13.0.2",
    "@angular/localize": "^13.0.2",
    "@angular/platform-browser": "13.0.2",
        ...
    "@ngrx/effects": "13.0.1",
    "@ngrx/entity": "13.0.1",
    "@ngrx/store": "13.0.1",
}
"devDependencies": {
 "@types/jest": "27.0.3",
   "jest": "^27.4.3",
    "jest-junit": "13.0.0",
    "jest-marbles": "3.0.1",
    "jest-preset-angular": "^11.0.1",
      ...
}

BaseUrl 在 tsconfig.json 中设置为“./src”。

{
  "compileOnSave": false,
  "compilerOptions": {
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "baseUrl": "./src",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "esModuleInterop": true,
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

这是开玩笑的配置:

"jest": {
    "preset": "jest-preset-angular",
    "setupFilesAfterEnv": [
      "<rootDir>/setupJest.ts"
    ],
    "moduleDirectories": [
      "node_modules",
      "src"
    ]
  }

【问题讨论】:

    标签: angular jestjs ngrx


    【解决方案1】:

    更新:此错误已在 v13.0.2 中解决

    这是一个已知问题,已在 https://github.com/ngrx/platform/issues/3248 中解决,将包含在 ngrx 的下一个版本中。

    在此之前,您可以安装夜间版本,https://ngrx.io/guide/nightlies

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-06
      • 1970-01-01
      • 2014-11-27
      • 2021-04-12
      • 1970-01-01
      • 2021-08-25
      • 1970-01-01
      相关资源
      最近更新 更多