New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not friendly with custom paths. #908
Comments
The configuration in our preset works with basic Angular project generated by Angular CLI. You can always override the configuration on your own for moduleNameMapper. I think the best is just removing moduleNameMapper from the preset which makes everyone happy :) |
Since we are going to have 9.0.0 release soon so that change can be included in 9.0.0 as breaking change. |
Thanks for the quick answer. Manually replacing at
The project customs roots and modulePaths applies and The workaround it to override each |
Closes #908 BREAKING CHANGE When generating a new project from Angular CLI, by default the `tsconfig.json` doesn't contain any path mappings hence removing `moduleNameMapper` from preset will make sure that the preset works in pair with `tsconfig.json`. Ones who are relying on the value of `moduleNameMapper` from the preset should create their own `moduleNameMapper` config manually or via `ts-jest` util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping
馃悰 Bug Report
Using jest-preset-angular have unexpected results with webapp path different of
src
.jest-preset-angular should not provide
src
hardcoded values at moduleNameMapper:jest-preset-angular/presets/index.js
Lines 15 to 20 in a14ab84
Instead, it should provide default values for roots and modulePaths:
To Reproduce
Steps to reproduce the behavior:
Angular application is implemented at
src/main/webapp
instead ofsrc
.Jest fails with:
Thats because moduleNameMapper takes precedence over modulePaths.
npm test -- --show-config
(relevant parts):Expected behavior
Jest should find the relevant modules.
Link to repo (highly encouraged)
Error log:
envinfo
The text was updated successfully, but these errors were encountered: