2017-04-19 46 views
4

我已将我的应用中的角度包从4.0.0-beta.5升级到4.0.0,并且当我看到以下错误运行我的单元测试:将角度从4.0.0-beta.5升级到4.0.0会破坏动画和单元测试

Error: Found the synthetic property @transition. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.

然后我安装@角/动画4.0.0和应用程序模块中所包括BrowserAnimationsModule如我使用动画。

现在我注意到,动画工作但测试失败,同样的错误。

任何帮助,将不胜感激。

回答

6

我发现这个问题,一些测试使用的角度测试平台

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

TestBed.configureTestingModule({ 
    imports: [ 
     RouterTestingModule, 
     ..., 
     BrowserAnimationsModule // Added this or NoopAnimationsModule** to fix it 
    ] 

NOTE**: you can also use NoopAnimationsModule instead if you don't want animations in your tests which is typically the case