Ionic Jasmine : env.stopOnSpecFailure is not a function after compiled successfully

回眸只為那壹抹淺笑 提交于 2020-01-01 08:05:12

问题


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

Following tutorial : 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"

Error Messages :

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

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

回答1:


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.

UPDATE:

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.



来源:https://stackoverflow.com/questions/49449082/ionic-jasmine-env-stoponspecfailure-is-not-a-function-after-compiled-successfu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!