Hi All

I'm new to Angular2 and am struggling with the basics.  I have a simple 
component and I thought it would be sensible to write a unit test.  I 
followed the Twain example 
which is very similar to what I am trying to achieve.
The issue is that whenever I include my test spec I see the error:

Chromium 52.0.2743 (Ubuntu 0.0.0) ClientLogoCarouselComponent encountered a 
declaration exception FAILED
Error: Cannot call Promise.then from within a sync test.
   at SyncTestZoneSpec.onScheduleTask 
(webpack:///home/matthew/Projects/cf/~/zone.js/dist/sync-test.js:11:0 <- 
   at ZoneDelegate.scheduleTask 
(webpack:///home/matthew/Projects/cf/~/zone.js/dist/zone.js:202:0 <- 
   at Zone.scheduleMicroTask 
(webpack:///home/matthew/Projects/cf/~/zone.js/dist/zone.js:139:0 <- 
   at scheduleResolveOrReject 
(webpack:///home/matthew/Projects/cf/~/zone.js/dist/zone.js:449:0 <- 
   at ZoneAwarePromise.then 
(webpack:///home/matthew/Projects/cf/~/zone.js/dist/zone.js:525:0 <- 
   at new ApplicationInitStatus 
<- src/test.ts:9491:60)
   at NgModuleInjector.DynamicTestModuleInjector.createInternal 
   at NgModuleInjector.create 
<- src/test.ts:17465:76)
   at NgModuleFactory.create 
<- src/test.ts:17450:18)
   at TestBed._initIfNeeded 
<- src/test.ts:5230:68)

I have setup my new project with Angular cli (1.0.0-beta.14; node: 6.4.0). 
 I run the test suite with 'ng test'

If I comment out 'client-logo-carousel.component.spec.ts' then the Twain 
test example runs fine in my project.

The stacktrace refers to test.ts which must somehow be the source of the 
problem.  I've included that in the plunkr.  I am stuck here so I hope 
someone can offer some guidance.

The code for the component is here:  


You received this message because you are subscribed to the Google Groups 
"AngularJS" 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