Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

test: stop the timed-out descendants case flaking under a full run

youxi7981101d9d9949f
diff --git a/tests/unit/shell.test.ts b/tests/unit/shell.test.ts
index 2ba0cad7..7364fa26 100644
--- a/tests/unit/shell.test.ts
+++ b/tests/unit/shell.test.ts
@@ -171,12 +171,20 @@ describe('structured process execution', () => {
executable: process.execPath,
args: ['-e', script, writes, childPidPath],
},
- 500,
+ 2000,
),
- ).rejects.toThrow('Command timed out after 500ms');
- const size = (await fs.stat(writes)).size;
+ ).rejects.toThrow('Command timed out after 2000ms');
+ // Under a loaded full run two node startups can outlast a short
+ // timeout, so the child may not have written yet; it must have spawned.
+ await fs.access(childPidPath);
+ const sizeOf = (file: string) =>
+ fs.stat(file).then(
+ (stat) => stat.size,
+ () => 0,
+ );
+ const size = await sizeOf(writes);
await new Promise((resolve) => setTimeout(resolve, 100));
- expect((await fs.stat(writes)).size).toBe(size);
+ expect(await sizeOf(writes)).toBe(size);
} finally {
endCancellation();
try {
@@ -187,5 +195,6 @@ describe('structured process execution', () => {
} catch {}
}
},
+ 15000,
);
});