Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I tried to migrate my project from karma to jest and it didn't work.
As I successfully did it for another project, I decided to dig a bit.
It's working for a single project but not for a mono repo (in v16 and v17)
Minimal Reproduction
ng new application --create-application false
cd application
ng g application app1 --ssr false --routing --style=scss
ng g application app2 --ssr false --routing --style=scss
angular.json
...
"test": {
"builder": "@angular-devkit/build-angular:jest",
"options": {
"tsConfig": "projects/app1/tsconfig.spec.json",
"polyfills": ["zone.js", "zone.js/testing"]
}
}
...
npm i jest jest-environment-jsdom @types/jest --save-dev
projects/app1/tsconfig.spec.json
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jest"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
Exception or Error
● Validation Error:
Module <rootDir>/jest-global.mjs in the setupFilesAfterEnv option was not found.
<rootDir> is: ...
Configuration Documentation:
https://jestjs.io/docs/configuration
Your Environment
Angular CLI: 16.1.6
Node: 18.16.1
Package Manager: npm 9.5.1
OS: win32 x64
Angular: 16.1.7
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1601.6
@angular-devkit/build-angular 16.1.6
@angular-devkit/core 16.1.6
@angular-devkit/schematics 16.1.6
@angular/cdk 16.1.6
@angular/cli 16.1.6
@schematics/angular 16.1.6
ng-packagr 16.1.0
rxjs 7.8.1
typescript 4.9.5
webpack 5.86.0
zone.js 0.13.1
Anything else relevant?
No response
Command
test
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I tried to migrate my project from karma to jest and it didn't work.
As I successfully did it for another project, I decided to dig a bit.
It's working for a single project but not for a mono repo (in v16 and v17)
Minimal Reproduction
angular.jsonprojects/app1/tsconfig.spec.json{ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", "types": [ "jest" ] }, "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" ] }ng test --project=app1Exception or Error
Your Environment
Anything else relevant?
No response