Bug 1746334 - [devtools] node tests: Suffix yarn command with .cmd on Windows r=Honza

Differential Revision: https://phabricator.services.mozilla.com/D135051
This commit is contained in:
Julian Descottes 2022-01-06 16:49:40 +00:00
Родитель 51f6dd7336
Коммит 759d0d82f3
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -18,6 +18,15 @@ const { execFileSync } = require("child_process");
const { chdir } = require("process"); const { chdir } = require("process");
const path = require("path"); const path = require("path");
const os = require("os");
// All Windows platforms report "win32", even for 64bit editions.
const isWin = os.platform() === "win32";
// On Windows, the ".cmd" suffix is mandatory to invoke yarn ; or executables in
// general.
const YARN_PROCESS = isWin ? "yarn.cmd" : "yarn";
// Supported node test suites for DevTools // Supported node test suites for DevTools
const TEST_TYPES = { const TEST_TYPES = {
JEST: "jest", JEST: "jest",
@ -147,7 +156,7 @@ function runTests() {
console.log("[devtools-node-test-runner] Check `yarn` is available"); console.log("[devtools-node-test-runner] Check `yarn` is available");
try { try {
// This will throw if yarn is unavailable // This will throw if yarn is unavailable
execFileSync("yarn", ["--version"]); execFileSync(YARN_PROCESS, ["--version"]);
} catch (e) { } catch (e) {
console.log( console.log(
"[devtools-node-test-runner] ERROR: `yarn` is not installed. " + "[devtools-node-test-runner] ERROR: `yarn` is not installed. " +
@ -157,12 +166,12 @@ function runTests() {
} }
console.log("[devtools-node-test-runner] Run `yarn` in test folder"); console.log("[devtools-node-test-runner] Run `yarn` in test folder");
execOut("yarn"); execOut(YARN_PROCESS);
console.log(`TEST START | ${SUITES[suite].type} | ${suite}`); console.log(`TEST START | ${SUITES[suite].type} | ${suite}`);
console.log("[devtools-node-test-runner] Run `yarn test` in test folder"); console.log("[devtools-node-test-runner] Run `yarn test` in test folder");
const { out, err } = execOut("yarn", ["test-ci"]); const { out, err } = execOut(YARN_PROCESS, ["test-ci"]);
if (err) { if (err) {
console.log("[devtools-node-test-runner] Error log"); console.log("[devtools-node-test-runner] Error log");