fix(test): prepare macos runner tmpdir

This commit is contained in:
Vincent Koc
2026-05-26 06:24:43 +02:00
parent c14c043be7
commit 7db4b3db41
2 changed files with 7 additions and 0 deletions

View File

@@ -1106,6 +1106,9 @@ function remoteAwsMacosJsBootstrap() {
`node_version=${shellQuote(nodeVersion)};`,
'arch="$(uname -m)";',
'case "$arch" in arm64) node_arch=arm64 ;; x86_64) node_arch=x64 ;; *) echo "unsupported macOS arch: $arch" >&2; return 2 ;; esac;',
'if [ -z "${TMPDIR:-}" ]; then export TMPDIR="/tmp"; fi;',
'if [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR" 2>/dev/null || export TMPDIR="/tmp"; fi;',
'if [ ! -d "$TMPDIR" ]; then echo "usable TMPDIR not found: $TMPDIR" >&2; return 1; fi;',
'node_dir="$tool_root/node-v${node_version}-darwin-${node_arch}";',
'export PATH="$node_dir/bin:$pnpm_home:$PATH";',
'if [ ! -x "$node_dir/bin/node" ]; then',

View File

@@ -274,6 +274,9 @@ describe("scripts/crabbox-wrapper", () => {
expect(remoteCommand).toContain("shasum -a 256 -c -");
expect(remoteCommand).not.toContain("set -euo pipefail");
expect(remoteCommand).toContain('return "$status"');
expect(remoteCommand).toContain('if [ -z "${TMPDIR:-}" ]; then export TMPDIR="/tmp"; fi;');
expect(remoteCommand).toContain('mkdir -p "$TMPDIR"');
expect(remoteCommand).toContain('usable TMPDIR not found: $TMPDIR');
expect(remoteCommand).toContain("node --version >&2");
expect(remoteCommand).toContain("pnpm --version >&2");
expectGroupedShellCommand(remoteCommand, "pnpm --version");
@@ -328,6 +331,7 @@ describe("scripts/crabbox-wrapper", () => {
"bootstrapping a pinned user-local Node toolchain before the command",
);
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js");
expect(output.scriptContent).toContain('if [ ! -d "$TMPDIR" ]; then mkdir -p "$TMPDIR"');
expect(output.scriptContent).toContain("openclaw_crabbox_bootstrap_macos_js || exit $?");
expect(output.scriptContent).toContain(`\n${script}`);
});