Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
test(javascript): synchronize worker cleanup and validate candidate facts
morluto5b5de1b52788
diff --git a/src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.test.ts b/src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.test.tsindex bb6f8b585..88af2ff6a 100644--- a/src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.test.ts+++ b/src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.test.ts@@ -31,3 +31,19 @@ it("versions fingerprints through the worker schema and rejects v1", () => {false,);});++it("accepts candidate endpoint interpretations from static analysis", () => {+ const facts = analyzeJavaScriptStaticSource(`http.request("POST", target);`);+ expect(facts.endpoints).toContainEqual(+ expect.objectContaining({+ kind: "network",+ value: "POST",+ interpretation: "candidate",+ }),+ );+ expect(+ javaScriptWorkerStaticAnalysisSchema.safeParse(+ JSON.parse(JSON.stringify(facts)) as unknown,+ ).success,+ ).toBe(true);+});diff --git a/tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts b/tests/boundary/javascript/javascriptSourceAnalysisWorker.test.tsindex 04ba5201f..9abf7ab3d 100644--- a/tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts+++ b/tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts@@ -162,10 +162,14 @@ it("ends worker stdin and unreferences process handles when cleanup reports insplet unreferenced = false;let permitCleanup = false;let childStdin: typeof process.stdin | undefined;+ let childExit: Promise<void> | undefined;const worker = new JavaScriptAnalysisWorker({ heapMb: 128, timeoutMs: 30_000 },async (request) => {const launched = await spawnOwnedProviderProcess(request);+ childExit = new Promise((resolve) => {+ launched.process.once("exit", () => resolve());+ });const originalUnref = launched.process.unref;launched.process.unref = () => {unreferenced = true;@@ -208,6 +212,7 @@ it("ends worker stdin and unreferences process handles when cleanup reports inspexpect(childStdin?.listenerCount("error")).toBeLessThanOrEqual(errorListeners ?? 0,);+ await childExit;permitCleanup = true;await worker.close();} finally {