Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(specs): failing specs now exit with non zero #2535

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,27 +153,38 @@ gulp.task('karma', function(done) {
browsers : argv.browsers ? argv.browsers.trim().split(',') : ['Chrome'],
configFile: __dirname + '/config/karma.conf.js'
};
var errorCount = 0;
function captureError(next) {
return function(exitCode) {
if (exitCode != 0) {
gutil.log(gutil.colors.red("Karma exited with the following exit code: " + exitCode));
errorCount++;
}
next();
};
};

gutil.log('Running unit tests on unminified source.');
buildJs(true);
karma.start(karmaConfig, testMinified);
karma.start(karmaConfig, captureError(testMinified));

function testMinified() {
gutil.log('Running unit tests on minified source.');
process.env.KARMA_TEST_COMPRESSED = true;
karma.start(karmaConfig, testMinifiedJquery);
karma.start(karmaConfig, captureError(testMinifiedJquery));
}

function testMinifiedJquery() {
gutil.log('Running unit tests on minified source w/ jquery.');
process.env.KARMA_TEST_COMPRESSED = true;
process.env.KARMA_TEST_JQUERY = true;
karma.start(karmaConfig, clearEnv);
karma.start(karmaConfig, captureError(clearEnv));
}

function clearEnv() {
process.env.KARMA_TEST_COMPRESSED = undefined;
process.env.KARMA_TEST_JQUERY = undefined;
if (errorCount > 0) { process.exit(errorCount); }
done();
}
});
Expand Down