加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

将角度从4.0.0-beta.5升级到4.0.0会破坏动画和单元测试

发布时间:2020-12-17 17:33:04 所属栏目:安全 来源:网络整理
导读:我已将我的应用程序中的角度包从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-beta.5升级到4.0.0,当我运行单元测试时,我看到以下错误:

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

然后我安装@ angular / animations 4.0.0并在app模块中包含BrowserAnimationsModule,因为我使用了动画.

现在我注意到动画有效,但测试失败并出现同样的错误.

任何帮助,将不胜感激.

解决方法

我发现了这个问题,一些测试使用了角度测试床

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读