@@ -48,6 +48,16 @@ exit 0
|
48 | 48 | await writeFile(logPath, ""); |
49 | 49 | } |
50 | 50 | |
| 51 | +async function expectMissingPath(path: string): Promise<void> { |
| 52 | +try { |
| 53 | +await stat(path); |
| 54 | +} catch (error) { |
| 55 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
| 56 | +return; |
| 57 | +} |
| 58 | +throw new Error(`Expected missing path: ${path}`); |
| 59 | +} |
| 60 | + |
51 | 61 | async function createDockerSetupSandbox(): Promise<DockerSetupSandbox> { |
52 | 62 | const rootDir = await sandboxRootTracker.make("suite"); |
53 | 63 | const scriptPath = join(rootDir, "scripts", "docker", "setup.sh"); |
@@ -462,9 +472,7 @@ describe("scripts/docker/setup.sh", () => {
|
462 | 472 | expect(result.stderr).toContain("Sandbox requires Docker CLI"); |
463 | 473 | const log = await readDockerLog(activeSandbox); |
464 | 474 | expect(log).toContain("config set agents.defaults.sandbox.mode off"); |
465 | | -await expect( |
466 | | -stat(join(activeSandbox.rootDir, "docker-compose.sandbox.yml")), |
467 | | -).rejects.toMatchObject({ code: "ENOENT" }); |
| 475 | +await expectMissingPath(join(activeSandbox.rootDir, "docker-compose.sandbox.yml")); |
468 | 476 | }); |
469 | 477 | |
470 | 478 | it("skips sandbox gateway restart when sandbox config writes fail", async () => { |
@@ -499,9 +507,7 @@ describe("scripts/docker/setup.sh", () => {
|
499 | 507 | expect.stringContaining("up -d --force-recreate openclaw-gateway"), |
500 | 508 | ); |
501 | 509 | expect(forceRecreateLine).not.toContain("docker-compose.sandbox.yml"); |
502 | | -await expect( |
503 | | -stat(join(activeSandbox.rootDir, "docker-compose.sandbox.yml")), |
504 | | -).rejects.toMatchObject({ code: "ENOENT" }); |
| 510 | +await expectMissingPath(join(activeSandbox.rootDir, "docker-compose.sandbox.yml")); |
505 | 511 | }); |
506 | 512 | }); |
507 | 513 | |
|