Open waterplea opened 4 months ago
We are following Angular CLI regarding to unit test. With Angular CLI, it also uses JIT compilation.
In general, to support AOT, we need a different flow comparing to current way. It will be kind of like
According to what I've known, using JIT compilation for test is faster than AOT.
@alan-agius4 would you please give us some more insights why Angular CLI uses JIT compilation for test? Thank you
AOT compilation speed has improved significantly over the years, so the speed improvements over JIT aren't that substantial. In the Angular CLI, JIT is currently used for unit tests but we are considering providing an option to use AOT. However, we first need to address a few questions, mainly concerning the correct semantics for writing tests and certain testing APIs that are JIT specific.
//cc @clydin and @dgp1130
🚀 Feature Proposal
It looks like currently JIT compiler is hardcoded: https://github.com/thymikee/jest-preset-angular/blob/main/src/compiler/ng-jest-compiler.ts#L63
I would be nice if we could use Jest with Angular AOT.
Motivation
JIT is barely ever used for years and is a very obscure mode that can cause issues that do not occur in real apps. AOT has been the default for nearly 10 major versions. Using AOT in Jest would improve testing environment by bringing it closer to the real life.
Example
No response