I'm running karma test cases through gulp as below:
gulp.task('unit-test-karma', function () {
return gulp.src(filePaths.libraryPaths.concat(filePaths.codePathsVerbose.concat(filePaths.testPaths).concat(filePaths.htmlPaths).concat(filePaths.jadePaths)))
//.pipe(plumber({ errorHandler: notify.onError(function(error) { console.log(error.message); return "Karma Error"; }) }))
.pipe(karma({
configFile: './karma.conf.js',
action: 'run', // watch
singleRun: true,
reporters: [ 'dots' ]
}));
});
When I run with action as run
, IE 11 throws below error.
IE 11.0.0 (Windows 10 0.0.0) ERROR
'expect' was used when there was no current spec, this could be because an asynchronous test timed out
at C:/BbCAT-WebDI/BbCAT-Web/BbCAT-Angular/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:938
But if run the same with action as watch
then all test case executing successfully in chrome, IE and firefox.
After reading some post, It seems there is some issue with $http service call but not able to find from where exactly the problem is!
This is a very real problem, I am currently experiencing it too. I think there is a core bug here. I have very well encapsulated tests. they are small (at most 3 lines each)
I have a main describe section with 2 nested describes first describe has 8 it() functions second has 3it() functions.
i.e
describe("main", ()=>{
describe("1st", ()=>{
//here are 8 it() definitions
})
describe("2nd", ()=>{
//here are 3 it() definitions
})
})
Now when I remove a single it() definition from either describe, the issue disappears. Alternatively, if I add a 3rd describe(), the issue disappears.
This is an issue in jasmine - either they are not reporting an error correctly, or there is something horribly wrong. Alternatively it may be karma trying to be smart by running multiple tests simultaneously.. Either way, this problem is real and it's got nothing to do with messy code.
Perhaps it has to do with the underlying unit being tested - my function is recursive (though my test cases don't dive deep).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With