-
Notifications
You must be signed in to change notification settings - Fork 376
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
Problems with Angular 12 + Jest #740
Comments
Hi @votdev , |
According to https://blog.lacolaco.net/2021/02/angular-ivy-library-compilation-design-in-depth-en/ the current mode I found a workaround by using the following in
Using
will finally solve the issue. Check just-jeb/angular-builders#679 (comment) for more details. Shall we close this issue or keep it open? I'm sure i'm not the only one who stumbles over that . |
I have a similar issue in production build: It shows: app.js?35bcaeb422be6d8ec610:2 ERROR Error: Uncaught (in promise): Error: Angular JIT compilation failed: '@angular/compiler' not loaded! The output still contains template strings but only for angular-gridster2. Even after running there is no |
@tiberiuzuld I'm seeing a similar issue in a library I'm responsible for, which is set for partial Ivy. Specifically getting an error simlar to this one: |
I created a bug in the jest-preset-angular repo for this issue, and provided a repo that demonstrates the issue, using this gridster library. |
We've found that running ngcc after install (postinstall on the top level package.json) solves the issue. |
We also have this issue, we are building AOT but seems that the builder does not rebuild linked libraries to AOT compatible, could not make it work even with running ngcc. |
I would definitely discourage changing |
It seems to be an issue with custom webpack builds, I can't find a way to force custom webpack to build AOT version of gridster component. Here is the same issue but without answer: https://stackoverflow.com/questions/68850485/can-ngtools-webpack-angularwebpackplugin-link-partially-compiled-ivy-libraries |
Out of curiosity, why use custom webpack for building, rather than the regular Angular builder setup? |
For me the following solved a lot of my issues: https://thymikee.github.io/jest-preset-angular/docs/guides/angular-ivy/ |
i had the same issue |
I'm currently migrating an
Angular 11
(andgridster 11.2.0
) project toAngular 12
(andgridster 12.0.0
). The migration went fine and the app is running, but my unit tests using Jest are failing.Another failure looks like:
The test is initialized the following way. Because of that the suggestion
This test module uses the component GridsterComponent which is using a "templateUrl" or "styleUrls", but they were never compiled. Please call "TestBed.compileComponents" before your test.
is irrelevant.With
Angular 11
andangular-gridster2
11.2.0
everything was fine. Does anyone have an idea what is going wrong?The text was updated successfully, but these errors were encountered: