Found the synthetic property @enterAnimation. Please include either “BrowserAnimationsModule” or “NoopAnimationsModule” in your application. Angular4

后端 未结 8 1397
生来不讨喜
生来不讨喜 2020-12-30 18:21

When running Karma to test my Angular4 application, I get this error Found the synthetic property @enterAnimation. Please include either \"BrowserAnimationsModule\" o

8条回答
  •  一向
    一向 (楼主)
    2020-12-30 18:48

    For my Angular 6 application, I resolved the issue by adding the following to my component .spec.ts file:

    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    

    Then add the BrowserAnimationsModule to the imports of the TestBed.configureTestingModule in the same component .spec.ts file

      beforeEach(async(() => {
        TestBed.configureTestingModule({
          declarations: [ LinkedSitesComponent ], imports: [ BrowserAnimationsModule ],
        })
        .compileComponents();
      }));
    

提交回复
热议问题