Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(hopper): fix fixture context and cleanup assumptions

morlutocd740a6764d2
diff --git a/tests/acceptance/providers/hopperStartupRecovery.test.ts b/tests/acceptance/providers/hopperStartupRecovery.test.ts
index 842fdaa07..f35ec68d6 100644
--- a/tests/acceptance/providers/hopperStartupRecovery.test.ts
+++ b/tests/acceptance/providers/hopperStartupRecovery.test.ts
@@ -306,7 +306,7 @@ test.for(["handoff", "not-found"] as const)(
const token = setting("REA_TOKEN");
const runId = setting("REA_RUN_ID");
runtime = dirname(socket);
- const lateBridge = async (identity: string, credential = token) => {
+ const lateBridge = (identity: string, credential = token) => {
const child = spawn(
process.execPath,
[
@@ -318,14 +318,14 @@ test.for(["handoff", "not-found"] as const)(
{ stdio: "ignore" },
);
children.push(child);
- await vi.waitFor(() => access(socket));
return child;
};
for (const [identity, credential] of [
["different-run", token],
[runId, "different-token"],
] as const) {
- const wrong = await lateBridge(identity, credential);
+ const wrong = lateBridge(identity, credential);
+ await vi.waitFor(() => access(socket));
expect(parseMcpToolError(await call("close_binary")).error.code).toBe(
"cleanup_incomplete",
);
@@ -336,7 +336,9 @@ test.for(["handoff", "not-found"] as const)(
}
const closing = call("close_binary");
await delay(150);
- const owned = await lateBridge(runId);
+ // A verified close may remove the socket before the fixture can poll it.
+ // The successful close and child exit establish the owned bridge outcome.
+ const owned = lateBridge(runId);
expect((await closing).isError).not.toBe(true);
await vi.waitFor(() => expect(owned.exitCode).toBe(0));
await expect(access(runtime)).rejects.toMatchObject({ code: "ENOENT" });