Fixes an issue with runtests-parallel when global mocha is not installed.
This commit is contained in:
Родитель
c14d711ab6
Коммит
5af8ba8bf8
|
@ -740,16 +740,25 @@ function runConsoleTests(defaultReporter, runInParallel) {
|
|||
tests = tests ? ' -g "' + tests + '"' : '';
|
||||
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
|
||||
console.log(cmd);
|
||||
|
||||
var savedNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
exec(cmd, function () {
|
||||
process.env.NODE_ENV = savedNodeEnv;
|
||||
runLinter();
|
||||
finish();
|
||||
}, function(e, status) {
|
||||
process.env.NODE_ENV = savedNodeEnv;
|
||||
finish(status);
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
var savedNodeEnv = process.env.NODE_ENV;
|
||||
process.env.NODE_ENV = "development";
|
||||
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
|
||||
process.env.NODE_ENV = savedNodeEnv;
|
||||
|
||||
// last worker clean everything and runs linter in case if there were no errors
|
||||
deleteTemporaryProjectOutput();
|
||||
jake.rmRf(taskConfigsFolder);
|
||||
|
|
|
@ -34,13 +34,7 @@ function discoverTests(run, options, cb) {
|
|||
console.log("Discovering tests...");
|
||||
|
||||
var cmd = "mocha -R " + require.resolve("./mocha-none-reporter.js") + " " + run;
|
||||
var p = child_process.spawn(
|
||||
process.platform === "win32" ? "cmd" : "/bin/sh",
|
||||
process.platform === "win32" ? ["/c", cmd] : ["-c", cmd], {
|
||||
windowsVerbatimArguments: true,
|
||||
env: { NODE_ENV: "development" }
|
||||
});
|
||||
|
||||
var p = spawnProcess(cmd);
|
||||
p.on("exit", function (status) {
|
||||
if (status) {
|
||||
cb(new Error("Process exited with code " + status));
|
||||
|
@ -87,18 +81,11 @@ function runTests(taskConfigsFolder, run, options, cb) {
|
|||
|
||||
// Start the background process.
|
||||
var cmd = "mocha -t " + (options.testTimeout || 20000) + " -R tap --no-colors " + run + " --config='" + partition.file + "'";
|
||||
var p = child_process.spawn(
|
||||
process.platform === "win32" ? "cmd" : "/bin/sh",
|
||||
process.platform === "win32" ? ["/c", cmd] : ["-c", cmd], {
|
||||
windowsVerbatimArguments: true,
|
||||
env: { NODE_ENV: "development" }
|
||||
});
|
||||
|
||||
var p = spawnProcess(cmd);
|
||||
var rl = readline.createInterface({
|
||||
input: p.stdout,
|
||||
terminal: false
|
||||
});
|
||||
|
||||
rl.on("line", onmessage);
|
||||
p.on("exit", onexit)
|
||||
|
||||
|
@ -259,6 +246,12 @@ function runTests(taskConfigsFolder, run, options, cb) {
|
|||
}
|
||||
}
|
||||
|
||||
function spawnProcess(cmd, options) {
|
||||
var shell = process.platform === "win32" ? "cmd" : "/bin/sh";
|
||||
var prefix = process.platform === "win32" ? "/c" : "-c";
|
||||
return child_process.spawn(shell, [prefix, cmd], { windowsVerbatimArguments: true });
|
||||
}
|
||||
|
||||
function ProgressBars(options) {
|
||||
if (!options) options = {};
|
||||
var open = options.open || '[';
|
||||
|
|
Загрузка…
Ссылка в новой задаче