diff --git a/src/docker-setup.test.ts b/src/docker-setup.test.ts index 9bc47c82ab7..cf2a1af2731 100644 --- a/src/docker-setup.test.ts +++ b/src/docker-setup.test.ts @@ -1,5 +1,5 @@ import { spawnSync } from "node:child_process"; -import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises"; +import { chmod, copyFile, mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join, resolve } from "node:path"; import { fileURLToPath } from "node:url"; @@ -46,8 +46,8 @@ async function createDockerSetupSandbox(): Promise { const binDir = join(rootDir, "bin"); const logPath = join(rootDir, "docker-stub.log"); - const script = await readFile(join(repoRoot, "docker-setup.sh"), "utf8"); - await writeFile(scriptPath, script, { mode: 0o755 }); + await copyFile(join(repoRoot, "docker-setup.sh"), scriptPath); + await chmod(scriptPath, 0o755); await writeFile(dockerfilePath, "FROM scratch\n"); await writeFile( composePath, @@ -95,7 +95,7 @@ describe("docker-setup.sh", () => { OPENCLAW_EXTRA_MOUNTS: undefined, OPENCLAW_HOME_VOLUME: undefined, }), - encoding: "utf8", + stdio: ["ignore", "ignore", "pipe"], }); expect(defaultsResult.status).toBe(0); const defaultsEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8"); @@ -111,7 +111,7 @@ describe("docker-setup.sh", () => { OPENCLAW_EXTRA_MOUNTS: "", OPENCLAW_HOME_VOLUME: "openclaw-home", }), - encoding: "utf8", + stdio: ["ignore", "ignore", "pipe"], }); expect(aptAndHomeVolumeResult.status).toBe(0); const aptEnvFile = await readFile(join(sandbox.rootDir, ".env"), "utf8");