adopt loader error handling
This commit is contained in:
parent
d728558a60
commit
a436a2550d
39
test/all.js
39
test/all.js
|
@ -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) {
|
||||||
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) {
|
||||||
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() {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in a new issue