Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 855
151291 Avatar asked Mar 23 '18 11:03

151291


1 Answers

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.

like image 128
Dennis Persson Avatar answered Nov 13 '22 06:11

Dennis Persson