I migrated the project from version 25 to 27 and the module '@ngrx/effects/testing' cannot more found. In my case the baseUrl in the project set to './src'.In other projects with baseUrl '.' and with the same jest, angular, ngrx the tests run without problems. Maybe some additional configuration for jest required?
This the message I get:
Cannot find module '@ngrx/store/testing' from 'src/app/app.component.spec.ts'.
some dependencies from 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 is set to "./src" in the tsconfig.json.
{
"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"
]
}
}
And here is the jest config:
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": [
"<rootDir>/setupJest.ts"
],
"moduleDirectories": [
"node_modules",
"src"
]
}
Update: this bug is resolved in v13.0.2
This is a known issue and is already solved in https://github.com/ngrx/platform/issues/3248, which will be included in the next release of ngrx.
Until then you can install a nightly version, https://ngrx.io/guide/nightlies