From 45fbdbc2dcede8115687ae02619854ed974c7d1f Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 12 May 2019 09:44:02 +0800 Subject: [PATCH] improve tests (#3408) --- test/jetstream.js | 13 +++++++++++-- test/release/run.js | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/test/jetstream.js b/test/jetstream.js index 2d85dfdd..e7c846e6 100644 --- a/test/jetstream.js +++ b/test/jetstream.js @@ -62,8 +62,17 @@ if (typeof phantom == "undefined") { if (debug) { console.log("http://localhost:" + port + "/"); } else { - child_process.exec("npm install phantomjs-prebuilt@2.1.14 --no-save", function(error) { - if (error) throw error; + child_process.spawn(process.platform == "win32" ? "npm.cmd" : "npm", [ + "install", + "phantomjs-prebuilt@2.1.14", + "--no-audit", + "--no-optional", + "--no-save", + "--no-update-notifier", + ], { + stdio: [ "ignore", 1, 2 ] + }).on("exit", function(code) { + if (code) throw new Error("npm install failed!"); var program = require("phantomjs-prebuilt").exec(process.argv[1], port); program.stdout.pipe(process.stdout); program.stderr.pipe(process.stderr); diff --git a/test/release/run.js b/test/release/run.js index 7b4755dc..5dc85193 100644 --- a/test/release/run.js +++ b/test/release/run.js @@ -6,10 +6,10 @@ module.exports = function(tasks) { var args = tasks.shift(); console.log(); console.log("\u001B[36m$> " + args.join(" ") + "\u001B[39m"); - var result = child_process.spawn(process.argv[0], args, { + child_process.spawn(process.argv[0], args, { stdio: [ "ignore", 1, 2 ] }).on("exit", function(code) { - if (code != 0) process.exit(code); + if (code) process.exit(code); next(); }); })(); -- 2.34.1