提交 27113518 编写于 作者: J Joao Moreno

fail mocha upon loader fail

related to #885
上级 db42fed4
......@@ -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);
});
};
......@@ -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);
});
});
......@@ -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();
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册