DEV Community

Discussion on: Unit Testing in Angular - To TestBed or NOT to TestBed

Collapse
layzee profile image
Lars Gyrup Brink Nielsen • Edited on

Which version of Angular are you using in the system you saw the speed differences in? With or without Ivy? A big component testing (TestBed) optimization was introduced in Angular Ivy version 9.

We don't have to render the full DOM of every component. We can use shallow component tests where we don't render the child components, but instead focus on the DOM generated by a single component template.

Collapse
jordanpowell88 profile image
Jordan Powell Author

Yes. I did forget to mention this in my article but we are currently on 7 and therefore not able to take advantage of the benefits of that optimization in IVY.

Collapse
layzee profile image
Lars Gyrup Brink Nielsen

That's sad. Angular 7 has been end of life for a while. Even version 8 will receive no more patches two months from now.

Definitely worth mentioning in your article that this might only apply to legacy versions of Angular using View Engine.

Thread Thread
jordanpowell88 profile image
Jordan Powell Author

Yes I am in the process of upgrading the app to 7. And yes I will work on adding that caveat to the article. I had it written down in my outline and then just completely forgot to actually add it into the article. I appreciate the feedback and the reminder!