Issue with Angular 8: `src/tsconfig.spec.json` => `tsconfig.spec.json`
yjaaidi opened this issue ยท 7 comments
Describe the bug
Using the schematic with Angular 8 then running the tests will produce the following error:
File not found: <rootDir>/src/tsconfig.spec.json (resolved as: /.../src/tsconfig.spec.json)
This is due to the fact that Angular 8 moves tsconfig.spec.json
out of src
while jest-angular-preset
is expecting tsconfig.spec.json
to be in src
.
Maybe jest-angular-preset
should automatically detect tsconfig.spec.json
location but it might be easier to handle this in this schematic as a temporary fix.
Meanwhile, there are two workarounds (and maybe more):
๐ Movetsconfig.spec.json
back tosrc
.โ Updatejest.config.js
:
const tsJestPreset = require('jest-preset-angular/jest-preset').globals['ts-jest'];
module.exports = {
...
globals: {
'ts-jest': {
...tsJestPreset,
tsConfig: 'tsconfig.spec.json'
}
}
};
To Reproduce
Steps to reproduce the behavior:
- npm install -g @angular/cli@8.0.0
- ng add @briebug/jest-schematic
- npm test
- See error
Thanks for putting this through an early Angular 8 test and for investigating the issue and resolutions.
Thank you for the schematic
I just opened the issue on jest-preset-angular too thymikee/jest-preset-angular#286
Also getting this same issue in an angular 8 project.
Also getting this same issue in an angular 8 project. +1
+1 On Ng7