-
Notifications
You must be signed in to change notification settings - Fork 12k
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
(Feature Request) Ability to use AOT in unit testing #6650
Comments
If we could run unit tests in AOT than we would have caught the latest bug which was published with 4.4.1 (angular/angular#19219) already on our build server, not just in staging, so this would be super useful. I read in multiple places, that AOT should become default for angular 5 - is this true? would that resolve this issue afterwards? |
Now that Angular@5 is released, this should be have more priority since we now need the reflect-es7 polyfills just to be able to run the unit tests: AOT can be enabled for serve/build, but not unit tests which is against the "AOT by default" promoted with Angular@5. Or maybe there is another way to enable AOT for tests (unit/e2e) or workaround for this, @hansl any ideas? |
Sorry for asking a question here but this is a blocking issue for us. Can anyone explain to me how to use relative template urls (aot style) in the source code, and then unit test that same source code with JIT.. i seem to be missing a trick? or is there another trick to unit test with AOT? thanks! |
Any update on this issue? |
There is a PR for it (#8007), as as mentioned in #8007 (comment) this support is still experimental and we'll wait until the feature stabilizes before incorporating it into the CLI. |
Just a +1 for this. Hopefully the compiler folks determine that AoT support is stable soon. Not only would this catch AoT compile errors, but it should also vastly speed up test runs because all of the components won't need to be re-compiled over and over again for every single spec method. |
This would be very useful. Since we are adopting AOT since 4.0, we ended up having another build step with AOT to ensure everything works |
Really, nothing has happened since June 2017? AOT is meanwhile almost a must and tests don't adopt it? |
@seawave23 Agree, and it's so sad that at a time where the focus is put on reducing the bundle size (Ivy renderer...) we still must keep the |
@sinedied with Angular CLI v6 you could use a separate polyfills.ts for the Unit tests in JIT mode. That means you don't need the reflect-ts7 for the real build 🎉 |
That's good news for a start, but still I don't like the fact that the code going to production is not the same one being tested, with different polyfills and build methods. |
Our development, QA and E2E testing is done using AOT mode - I can "live" with that danger/rsik that JIT it used for the unit tests for the time being, but totally agree that the AOT support is long overdue :) |
@timbru31 How are you running your E2E tests in AOT mode? I am on ng6 and there is no --aot option. |
Just as a note, the wiki states it is possible, or implies it anyways... |
@boldwade I can't find anything on the wiki you linked that states that aot can be used. |
It's ambiguous. The wiki page (listed above) links to the |
But does this mean that aot will/can be used? |
right, see the confusion... |
I suspect this would also make it possible to include template binding expressions in code coverage reports (as suggested here angular/angular#427) which would be useful - currently I find the code coverage report pretty meaningless for components that include a lot of logic in their templates. |
@filipesilva by what feature/bug is this blocked? |
Yesterday, I tried to run tests in AOT + IVY and got some success for some simple tests. I got problem with type checking in templates. I had NO_ERRORS_SCHEME but type checking was enabled for unknown components. |
I tried Karma and For now, I close this issue because my motivation, which was to improve performance of unit testing, has already achieved . |
@Quramy Which version did you try? |
|
@Quramy I couldn't find any references to |
@giggio I've commented angular/angular#12409 (comment) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
Repro steps.
The log given by the failure.
Desired functionality.
At
@angular/core/testing
v4.2.0, .ngSummary.ts files are introduced to support to use AOT in unit testing ( https://github.com/angular/angular/blob/master/CHANGELOG.md#features-4 ). Do you have a milestone about this?I think it's useful to run unit testing with something like
ng test --aot
.Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: