Hi all,

I'm getting a strange error running Karma/jasmine tests in Angular 2, can 
anyone help? The code is generated using angular-cli, and uses that as test 
framework. I can get basic component tests to pass, but as soon as I add 
dependencies to services, I get this:

Error: No provider for String!
Error: DI Error
   at NoProviderError.ZoneAwareError 
(webpack:///~/zone.js/dist/zone.js:958:0 <- src/polyfills.ts:4435:33)
   at NoProviderError.BaseError [as constructor] 
(webpack:///~/@angular/core/src/facade/errors.js:22:0 <- 
src/test.ts:29766:16)
   at NoProviderError.AbstractProviderError [as constructor] 
(webpack:///~/@angular/core/src/di/reflective_errors.js:54:0 <- 
src/test.ts:59262:16)
   at new NoProviderError 
(webpack:///~/@angular/core/src/di/reflective_errors.js:116:0 <- 
src/test.ts:59324:16)
   at ReflectiveInjector_._throwOrNull 
(webpack:///~/@angular/core/src/di/reflective_injector.js:485:0 <- 
src/test.ts:82147:19)
   at ReflectiveInjector_._getByKeyDefault 
(webpack:///~/@angular/core/src/di/reflective_injector.js:524:0 <- 
src/test.ts:82186:25)
   at ReflectiveInjector_._getByKey 
(webpack:///~/@angular/core/src/di/reflective_injector.js:456:0 <- 
src/test.ts:82118:25)
   at ReflectiveInjector_.get 
(webpack:///~/@angular/core/src/di/reflective_injector.js:325:0 <- 
src/test.ts:81987:21)
   at DynamicTestModuleInjector.get 
(/DynamicTestModule/module.ngfactory.js:130:107)
   at DynamicTestModuleInjector.getInternal 
(/DynamicTestModule/module.ngfactory.js:197:53)
   at DynamicTestModuleInjector.NgModuleInjector.get 
(webpack:///~/@angular/core/src/linker/ng_module_factory.js:139:25 <- 
src/test.ts:60197:44)
   at TestBed.get 
(webpack:///~/@angular/core/bundles/core-testing.umd.js:826:0 <- 
src/test.ts:2031:51)
   at CompiledTemplate.proxyViewClass.AppView.injectorGet 
(webpack:///~/@angular/core/src/linker/view.js:152:0 <- 
src/test.ts:82922:45)
   at CompiledTemplate.proxyViewClass.DebugAppView.injectorGet 
(webpack:///~/@angular/core/src/linker/view.js:580:0 <- 
src/test.ts:83350:49)
   at 
CompiledTemplate.proxyViewClass.View_RegisterComponent_Host0.createInternal 
(/DynamicTestModule/RegisterComponent/host.ngfactory.js:15:126)

Thanks if anyone can help, or tell me where to look :)

Cheers,
Justin

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to