-
Notifications
You must be signed in to change notification settings - Fork 305
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug?] Why moduleFileExtensions: [json] causes transformation error (Unexpected token import)? #194
Comments
I found out the workaround from nrwl/nx project. |
cc @thymikee |
That's weird, I wouldn't expect this kind of error in this case. Do you have a repro? |
I'll make it. 👍 |
I tried to create a repro, but I couldn't. https://github.com/lacolaco/jest-preset-angular-issues194
Then
But it isn't solved... I gave up 😇 |
I think something wrong when reading js config because this doesn't happen to json config in package.json |
@ahnpnl I've changed my
|
your latest changes in your repo worked for me. I think you need to run |
@ahnpnl Ahhhh, it works well after clearing cache!! Thank you so much!! |
also when I move the config to |
You're right. I guess the first problem (about moduleFileExtensions) was caused the same reason... At now, my situation is solved, so I close this issue. Thank you for your kind replies. |
Here are weird behaviors happening in my environment.
At first, I tried to set up my Angular CLI project to use jest-preset-angular, but it didn't work.
My
src/setupJest.ts
is only one line.And my
jest.config.js
is very simple. Other files are never modified from Angular CLI default.But when I added
moduleFileExtensions
tojest.config.js
, it works well.Notable point is that
moduleFileExtensions
must not includejson
.In
jest-preset.json
,moduleFileExtensions
is defined as below.As well as that, if I add
json
to mymoduleFileExtensions
, it doesn't work.json
causes a transformation error. It's very weird.My question:
json
causes a transformation error?moduleFileExtensions: ['ts', 'js', 'html']
) bad solution?Thanks.
The text was updated successfully, but these errors were encountered: