Angular 2 Unit Testing — Still a Night mare
I was fallen in love with Angular 2 in first sight, because, Angular 2 has a cleaner sense of separation of concern. It’s purely component based which Angular 1 was not. Angular 2 has much better logical data modelling than Angular 1. So, I decided to take Angular 2 as the front end framework for my next personal project.
I started this project two months ago with few Proof of Concept implementations. Framework was in beta stage when I first integrate it with my project. Since I am a strong follower of TDD and BDD I am always looking for the support framework gives for unit and integration testing. When I started with Angular 2, its Unit and Integration testing support was not in a satisfiable stage, but I jumped in to the Google’s new framework with the belief that it will be stable in few months time.
Now it is in RC stage. Ever since, everyday, if I get an npm update to upgrade Angular, I have to spend few hours fixing my broken unit tests. During beta days, it was acceptable. Once the framework is pushed to RC state, like all others, I also expected a stable framework and I don’t want to spend most of my coding time to fine tune and shape the underlying unit testing framework instead of building my application … :(
Today I hit by following problem again …
TestComponentBuilder/inject does not work, when component has templateUrl — https://github.com/angular/angular/issues/5662