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

adopt loader error handling

上级 d728558a
...@@ -38,17 +38,9 @@ function loadSingleTest(test) { ...@@ -38,17 +38,9 @@ function loadSingleTest(test) {
var moduleId = path.relative(src, path.resolve(test)).replace(/\.js$/, ''); var moduleId = path.relative(src, path.resolve(test)).replace(/\.js$/, '');
return function (cb) { return function (cb) {
var onExit = function () {
console.error('Failed to load test.');
process.exit(1);
};
process.once('exit', onExit);
define([moduleId], function () { define([moduleId], function () {
process.removeListener('exit', onExit);
cb(null); cb(null);
}); }, cb);
}; };
} }
...@@ -58,18 +50,10 @@ function loadClientTests(cb) { ...@@ -58,18 +50,10 @@ function loadClientTests(cb) {
return file.replace(/\.js$/, ''); 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 // load all modules
define(modules, function () { define(modules, function () {
process.removeListener('exit', onExit);
cb(null); cb(null);
}); }, cb);
}); });
} }
...@@ -81,17 +65,9 @@ function loadPluginTests(cb) { ...@@ -81,17 +65,9 @@ function loadPluginTests(cb) {
return 'extensions/' + file.replace(/\.js$/, ''); 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() { define(modules, function() {
process.removeListener('exit', onExit); cb(null);
cb(); }, cb);
});
}); });
} }
...@@ -169,7 +145,12 @@ function main() { ...@@ -169,7 +145,12 @@ function main() {
loadTasks.push(loadPluginTests); loadTasks.push(loadPluginTests);
} }
async.parallel(loadTasks, function () { async.parallel(loadTasks, function (err) {
if (err) {
console.error(err);
return process.exit(1);
}
process.stderr.write = write; process.stderr.write = write;
if (!argv.run) { if (!argv.run) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册