Skip to content

Commit 6793592

Browse files
committed
fix formatting
1 parent c0a3fae commit 6793592

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

tests/run-shell.mjs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import commandLineArgs from "command-line-args";
44
import commandLineUsage from "command-line-usage";
55
import { spawnSync } from "child_process";
66
import { fileURLToPath } from "url";
7-
import { styleText } from 'node:util';
7+
import { styleText } from "node:util";
88
import * as path from "path";
99
import * as fs from "fs";
10-
import * as os from 'os';
10+
import * as os from "os";
1111
import core from "@actions/core"
1212

1313
const optionDefinitions = [
@@ -77,7 +77,7 @@ const GITHUB_ACTIONS_OUTPUT = "GITHUB_ACTIONS_OUTPUT" in process.env;
7777
function log(...args) {
7878
const text = args.join(" ")
7979
if (GITHUB_ACTIONS_OUTPUT)
80-
core.notice(styleText("yellow", text))
80+
core.info(styleText("yellow", text))
8181
else
8282
console.log(styleText("yellow", text))
8383
}
@@ -106,9 +106,9 @@ function sh(binary, args) {
106106
const cmd = `${binary} ${args.join(" ")}`;
107107
if (GITHUB_ACTIONS_OUTPUT) {
108108
core.startGroup(binary);
109-
core.notice(cmd);
109+
core.notice(styleText("blue", cmd));
110110
} else {
111-
console.log(styleText("cyan", cmd));
111+
console.log(styleText("blue", cmd));
112112
}
113113
try {
114114
const result = spawnSync(binary, args, SPAWN_OPTIONS);
@@ -131,9 +131,29 @@ async function runTests() {
131131
});
132132
}
133133

134+
function jsvuOSName() {
135+
const osName = () => {
136+
switch (os.platform()) {
137+
case "win32": return "win";
138+
case "darwin": return "mac";
139+
case "linux": return "linux";
140+
default: throw new Error("Unsupported OS");
141+
}
142+
};
143+
const osArch = () => {
144+
switch (os.arch()) {
145+
case "x64": return "64";
146+
case "ia32": return "32";
147+
case "arm64": return "64arm";
148+
default: throw new Error("Unsupported architecture");
149+
}
150+
};
151+
return `${osName()}${osArch()}`
152+
}
153+
134154
function testSetup() {
135155
const jsvuOS = "mac64arm";
136-
sh("jsvu", [`--engines=${SHELL_NAME}`, `--os=${jsvuOS}`]);
156+
sh("jsvu", [`--engines=${SHELL_NAME}`, `--os=${jsvuOSName()}`]);
137157
const shellBinary = path.join(os.homedir(), ".jsvu/bin", SHELL_NAME);
138158
if (!fs.existsSync(shellBinary))
139159
throw new Error(`Could not find shell binary: ${shellBinary}`);

0 commit comments

Comments
 (0)