Skip to content

Commit c8c5cec

Browse files
committed
Fix test to use WORKSPACE_EXECUTE_BASH and add File polyfill
- Changed from non-existent RUNTIME_EXEC to WORKSPACE_EXECUTE_BASH - Fixed result structure to access .result.stdout - Added File polyfill to tests/setup.ts for Node 18 + undici compatibility - Remove stray documentation file Test now compiles correctly. Actual execution requires Docker for SSH tests.
1 parent 344f7ae commit c8c5cec

File tree

3 files changed

+29
-101
lines changed

3 files changed

+29
-101
lines changed

tests/ipcMain/RUN_TRUNK_BRANCH_TEST.md

Lines changed: 0 additions & 88 deletions
This file was deleted.

tests/ipcMain/createWorkspace.test.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -341,36 +341,39 @@ describeIntegration("WORKSPACE_CREATE with both runtimes", () => {
341341
await new Promise((resolve) => setTimeout(resolve, getInitWaitTime()));
342342

343343
// Verify the new branch was created from custom-trunk, not from default branch
344-
// Use RUNTIME_EXEC to check files (works for both local and SSH runtimes)
344+
// Use WORKSPACE_EXECUTE_BASH to check files (works for both local and SSH runtimes)
345345

346346
// Check that trunk-file.txt exists (from custom-trunk)
347-
const checkTrunkFileStream = await env.mockIpcRenderer.invoke(
348-
IPC_CHANNELS.RUNTIME_EXEC,
347+
const checkTrunkFileResult = await env.mockIpcRenderer.invoke(
348+
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
349349
result.metadata.id,
350350
`test -f trunk-file.txt && echo "exists" || echo "missing"`,
351-
{ timeout: 10 }
351+
{ timeout_secs: 10 }
352352
);
353-
const trunkFileOutput = await readStream(checkTrunkFileStream.stdout);
353+
expect(checkTrunkFileResult.success).toBe(true);
354+
const trunkFileOutput = await readStream(checkTrunkFileResult.result.stdout);
354355
expect(trunkFileOutput.trim()).toBe("exists");
355356

356357
// Check that other-file.txt does NOT exist (from other-branch)
357-
const checkOtherFileStream = await env.mockIpcRenderer.invoke(
358-
IPC_CHANNELS.RUNTIME_EXEC,
358+
const checkOtherFileResult = await env.mockIpcRenderer.invoke(
359+
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
359360
result.metadata.id,
360361
`test -f other-file.txt && echo "exists" || echo "missing"`,
361-
{ timeout: 10 }
362+
{ timeout_secs: 10 }
362363
);
363-
const otherFileOutput = await readStream(checkOtherFileStream.stdout);
364+
expect(checkOtherFileResult.success).toBe(true);
365+
const otherFileOutput = await readStream(checkOtherFileResult.result.stdout);
364366
expect(otherFileOutput.trim()).toBe("missing");
365367

366368
// Verify git log shows the custom trunk commit
367-
const gitLogStream = await env.mockIpcRenderer.invoke(
368-
IPC_CHANNELS.RUNTIME_EXEC,
369+
const gitLogResult = await env.mockIpcRenderer.invoke(
370+
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
369371
result.metadata.id,
370372
`git log --oneline --all`,
371-
{ timeout: 10 }
373+
{ timeout_secs: 10 }
372374
);
373-
const logOutput = await readStream(gitLogStream.stdout);
375+
expect(gitLogResult.success).toBe(true);
376+
const logOutput = await readStream(gitLogResult.result.stdout);
374377
expect(logOutput).toContain("Custom trunk commit");
375378

376379
await cleanup();

tests/setup.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,16 @@ require("disposablestack/auto");
99

1010
assert.equal(typeof Symbol.dispose, "symbol");
1111
assert.equal(typeof Symbol.asyncDispose, "symbol");
12+
13+
// Polyfill File for Node 18 (undici needs it)
14+
if (typeof globalThis.File === "undefined") {
15+
(globalThis as any).File = class File extends Blob {
16+
constructor(bits: BlobPart[], name: string, options?: FilePropertyBag) {
17+
super(bits, options);
18+
this.name = name;
19+
this.lastModified = options?.lastModified ?? Date.now();
20+
}
21+
name: string;
22+
lastModified: number;
23+
};
24+
}

0 commit comments

Comments
 (0)