Skip to content

Commit

Permalink
fail mocha upon loader fail
Browse files Browse the repository at this point in the history
related to microsoft#885
  • Loading branch information
joaomoreno committed Dec 2, 2015
1 parent db42fed commit 2711351
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ function loadSingleTest(test) {
var moduleId = path.relative(src, path.resolve(test)).replace(/\.js$/, '');

return function (cb) {
var onExit = function () {
console.error('Failed to load test.');
process.exit(1);
};

process.once('exit', onExit);

define([moduleId], function () {
process.removeListener('exit', onExit);
cb(null);
});
};
Expand All @@ -50,8 +58,16 @@ function loadClientTests(cb) {
return file.replace(/\.js$/, '');
});

var onExit = function () {
console.error('Failed to load all client tests.');
process.exit(1);
};

process.once('exit', onExit);

// load all modules
define(modules, function () {
process.removeListener('exit', onExit);
cb(null);
});
});
Expand All @@ -65,7 +81,15 @@ function loadPluginTests(cb) {
return 'extensions/' + file.replace(/\.js$/, '');
});

var onExit = function () {
console.error('Failed to load plugin tests.');
process.exit(1);
};

process.once('exit', onExit);

define(modules, function() {
process.removeListener('exit', onExit);
cb();
});
});
Expand Down

0 comments on commit 2711351

Please sign in to comment.