Ionic Jasmine:env.stopOnSpecFailure在编译成功后不是函数 [英] Ionic Jasmine : env.stopOnSpecFailure is not a function after compiled successfully

查看:269
本文介绍了Ionic Jasmine:env.stopOnSpecFailure在编译成功后不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Ionic与jasmine-karma,在运行测试时,获得成功编译,但在jasmine仪表板中,在控制台中出现空白屏幕错误。

Using Ionic with jasmine-karma, while run test, getting success compile but in jasmine dashboard getting empty screen with error in console.

以下教程: https://leifwells.github.io / 2017/08/27 / testing-in-ionic-configure-existing-projects-for-testing /

"ts-loader": "^4.1.0",
"jasmine-core": "^2.99.1"

错误消息:

TypeError: env.stopOnSpecFailure is not a function at adapter.js:26

Error: Module build failed: TypeError: Cannot read property 'afterCompile' of undefined


推荐答案

尝试使用stopOnSpecFailure函数的karma-jasmine版本发生故障。您的jasmine-core版本中不存在该功能,您需要版本3或更高版本。版本3.1.0现在是最新的,并且运行良好。另请注意,如果您使用的是Webpack 3,还应降级ts-loader到3.5.0

The failure occurs in your version of karma-jasmine which tries to use the stopOnSpecFailure function. That function is not present in your version of jasmine-core, you'll need version 3 or greater. Version 3.1.0 is the newest right now and works good. Also note that if you're using Webpack 3 you should also downgrade ts-loader to 3.5.0.

更新:

我注意到有很多人建议将茉莉核心降级为2.99.1。显然人们在使用jasmine-core 3时遇到了问题。如果是这种情况,那么你可以使用 karma-jasmine-html-reporter 0.2.2版和jasmine-core 2.99.1。

I noticed that many people suggests downgrading jasmine-core to 2.99.1. Apparently people have problems using jasmine-core 3. If that's the case for you, then you can use karma-jasmine-html-reporter version 0.2.2 together with jasmine-core 2.99.1.

这篇关于Ionic Jasmine:env.stopOnSpecFailure在编译成功后不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆