Skip to content

Commit 60f4d53

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 1accff3 commit 60f4d53

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
@@ -338,36 +338,39 @@ describeIntegration("WORKSPACE_CREATE with both runtimes", () => {
338338
await new Promise((resolve) => setTimeout(resolve, getInitWaitTime()));
339339

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

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

353354
// Check that other-file.txt does NOT exist (from other-branch)
354-
const checkOtherFileStream = await env.mockIpcRenderer.invoke(
355-
IPC_CHANNELS.RUNTIME_EXEC,
355+
const checkOtherFileResult = await env.mockIpcRenderer.invoke(
356+
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
356357
result.metadata.id,
357358
`test -f other-file.txt && echo "exists" || echo "missing"`,
358-
{ timeout: 10 }
359+
{ timeout_secs: 10 }
359360
);
360-
const otherFileOutput = await readStream(checkOtherFileStream.stdout);
361+
expect(checkOtherFileResult.success).toBe(true);
362+
const otherFileOutput = await readStream(checkOtherFileResult.result.stdout);
361363
expect(otherFileOutput.trim()).toBe("missing");
362364

363365
// Verify git log shows the custom trunk commit
364-
const gitLogStream = await env.mockIpcRenderer.invoke(
365-
IPC_CHANNELS.RUNTIME_EXEC,
366+
const gitLogResult = await env.mockIpcRenderer.invoke(
367+
IPC_CHANNELS.WORKSPACE_EXECUTE_BASH,
366368
result.metadata.id,
367369
`git log --oneline --all`,
368-
{ timeout: 10 }
370+
{ timeout_secs: 10 }
369371
);
370-
const logOutput = await readStream(gitLogStream.stdout);
372+
expect(gitLogResult.success).toBe(true);
373+
const logOutput = await readStream(gitLogResult.result.stdout);
371374
expect(logOutput).toContain("Custom trunk commit");
372375

373376
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)