Reputation: 4309
Are there any instructions or example set ups for how to inject dependencies in Angular 2, latest release?
The Testing Guide is still incomplete, and only takes you so far. If, for example, you want to test a component that takes @Input()
parameters, my understanding is that you specifically need to inject it, but I've run into some problems getting this to work.
When I try to follow examples such as this one I get errors about configureCompiler
not being a part of @angular/core/testing
. I believe this may have been moved into TestBed but when I try to use call TestBed.createComponent(MyComponent)
I get an error that there's No provider for TestingCompilerFactory!
And when I try to import it from @angular/compiler/testing
I get a Typescript compiler error that it isn't there. Doing a grep, I can find the file it's in in my local node_nodiles
but then that file gives a bunch of Typescript errors if I try to import it!
Is there any straightforward guide on how to do this?
Upvotes: 0
Views: 188
Reputation: 3575
Getting testing in RC5 can be difficult as it's still so new. You can look at this angular2-starter (https://github.com/antonybudianto/angular2-starter) and see how he has implemented testing in RC5.
Upvotes: 2