-
Notifications
You must be signed in to change notification settings - Fork 310
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]: Angular 14 - Did you run and wait for 'resolveComponentResources()' #1617
Comments
The error is about the AST transformers are not applied. Not sure why this happens while it doesn't happen to https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-v14 |
I'd guess it has something to do with monorepo setup and Yarn workspaces, but you're the expert 😅 |
When I compare between We have example for yarn workspace at https://github.com/thymikee/jest-preset-angular/tree/main/examples/example-app-yarn-workspace which don’t have the issue. Maybe you can take a look to see. I believe this is something with workspace configuration which is sort of out of scope to handle. |
The change in |
@ahnpnl The example app in the monorepo uses Angular 13 so I can't fairly compare this setup to mine. |
Update: |
Thanks for the updating! |
@just-jeb you're not the only one with this problem. Can you share what exactly were your steps to resolve this issue?
|
As I mentioned, it was a dependency hell, try to make sure that you don't have some weird hierarchy or non-hoisted modules in case of monorepo. |
tl;dr Use Typescript < 4.8 @GeorgeTailor I had the same issue as you with exactly the same deps.
Turns out the issue was Weird thing is that if you |
I had the exact same issue, and the root cause is the same what you have mentioned. I downgraded the typescript version from 4.8.4 to 4.7.2 and it worked. |
I had the same issue after updating to Angular 15, which supports TypeScript 4.8 or higher. Because I didn't want to downgrade my TypeScript to 4.7 (which is mentioned as workaround in the comment above) just so I could test Components in Jest (in fact, I've updated my TS 4.8 it to 4.9.5 instead), I've tried to see if anything else was causing an issue. The version combinations I was using that gave me the same error:
Updating Jest itself to 29.4.1 (current latest) fixed the issue for me. Not sure what changed since 28.1.1 that caused the issue, but this did the trick for me. It seems juggling with the versions of jest, jest-preset-angular, and typescript is required when encountering this issue. Hopefully a minor/major version update of any of these three dependencies won't cause the same issue again in the future, but I'm glad it's at least working for me now with the current latest versions for all three. |
Version
12.1.0
Steps to reproduce
git@github.com:just-jeb/angular-builders.git
14.x.x-update-jest
yarn --forzen-lockfile
cd examples/jest/simple-app
yarn jest
Expected behavior
The tests pass
Actual behavior
The tests fail
Additional context
I'm facing this issue while trying to update
@angular-builders/jest
to the latestJest
andjest-preset-angular
versions.At first I was convinced something is wrong with the builder, so I did multiple attempts to try and fix it.
However, after creating a simple jest.config just as described in the docs of
jest-preset-angular
I realized that even without the builder it fails with the same error.So either the docs are missing an important piece of information or the preset is not working properly with Angular 14.
Environment
The text was updated successfully, but these errors were encountered: