fix(crabbox): bootstrap WSL2 package proof

This commit is contained in:
Vincent Koc
2026-06-24 20:01:23 +08:00
parent af2b0a6118
commit e4763b0631
2 changed files with 263 additions and 43 deletions

View File

@@ -732,8 +732,49 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
"check:changed",
]);
const output = parseFakeCrabboxOutput(result);
const remoteCommand = normalizeShellLineEndings(output.scriptContent);
expect(result.status).toBe(0);
expect(parseFakeCrabboxOutput(result).args).toEqual([
expect(output.args.slice(0, 7)).toEqual([
"run",
"--target",
"windows",
"--windows-mode",
"wsl2",
"--provider",
"azure",
]);
expect(output.args).toContain("--no-hydrate");
expect(output.args).toContain("--script");
expect(output.args).not.toContain("--shell");
expect(output.args.join(" ")).not.toContain("openclaw_crabbox_bootstrap_wsl2_js");
expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_wsl2_js");
expect(remoteCommand).toContain("node-v${node_version}-linux-${node_arch}.tar.gz");
expect(remoteCommand).toContain("sha256sum -c -");
expect(remoteCommand).toContain("corepack enable --install-directory");
expect(remoteCommand).toContain("pnpm install --frozen-lockfile");
expect(remoteCommand).toContain("openclaw_crabbox_bootstrap_wsl2_js || exit $?");
expect(remoteCommand).toContain(
`{ openclaw_crabbox_env ${remoteChangedGateEnvPrefix} corepack pnpm check:changed\n}`,
);
expect(result.stderr).toContain("provider=azure");
});
it("keeps WSL2 non-JavaScript commands on the default hydrate path", () => {
const result = runWrapper(azureProviderHelp, [
"run",
"--target",
"windows",
"--windows-mode",
"wsl2",
"--",
"echo",
"ok",
]);
const output = parseFakeCrabboxOutput(result);
expect(result.status).toBe(0);
expect(output.args).toEqual([
"run",
"--target",
"windows",
@@ -742,11 +783,11 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
"--provider",
"azure",
"--",
"corepack",
"pnpm",
"check:changed",
"echo",
"ok",
]);
expect(result.stderr).toContain("provider=azure");
expect(output.args).not.toContain("--no-hydrate");
expect(output.args).not.toContain("--shell");
});
it("keeps explicit provider env overrides for Windows runs", () => {
@@ -1570,7 +1611,16 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
it("preflights Swift and JS tooling for raw AWS macOS dist package scripts", () => {
const result = runWrapper(
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
["run", "--provider", "aws", "--target", "macos", "--", "bash", "scripts/package-mac-dist.sh"],
[
"run",
"--provider",
"aws",
"--target",
"macos",
"--",
"bash",
"scripts/package-mac-dist.sh",
],
);
const output = parseFakeCrabboxOutput(result);
@@ -1602,7 +1652,16 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
it("keeps raw AWS macOS build-and-run scripts Swift-only", () => {
const result = runWrapper(
"provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n",
["run", "--provider", "aws", "--target", "macos", "--", "bash", "scripts/build-and-run-mac.sh"],
[
"run",
"--provider",
"aws",
"--target",
"macos",
"--",
"bash",
"scripts/build-and-run-mac.sh",
],
);
const output = parseFakeCrabboxOutput(result);