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(process): use owned CLI and workspace fixtures
morluto4940a867e2e5
diff --git a/tests/boundary/process/processCli.test.ts b/tests/boundary/process/processCli.test.tsindex 418648105..3da9205f6 100644--- a/tests/boundary/process/processCli.test.ts+++ b/tests/boundary/process/processCli.test.ts@@ -1,13 +1,14 @@-import { readFile, rm, writeFile } from "node:fs/promises";+import { readFile, writeFile } from "node:fs/promises";import { join } from "node:path";import { fileURLToPath } from "node:url";import { execFile } from "node:child_process";import { promisify } from "node:util";-import { afterEach, describe, expect, it } from "vitest";+import { describe, expect, it } from "vitest";import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";+import { cliTest } from "../../support/cli/cliFixture.js";import {captureProcessScenarioFile,@@ -19,27 +20,14 @@ import { ProcessCaptureError } from "../../../src/process/capture/ProcessCaptureimport { PROCESS_PROVIDER } from "../../../src/domain/process/processEvidenceProvider.js";import { INVESTIGATION_EXAMPLES } from "../../../src/contracts/investigationExamples.js";-const roots: string[] = [];const execFileAsync = promisify(execFile);const CLI_INTEGRATION_TIMEOUT_MS = 60_000;-afterEach(async () => {- await Promise.all(- roots.splice(0).map((root) => rm(root, { recursive: true, force: true })),- );-});--const fixture = async (): Promise<string> => {- const root = await createTestTempDirectory("rea-process-cli-");- roots.push(root);- return root;-};-describe("documented process CLI workflow", () => {- it(+ cliTest("feeds the documented JSON capture into the comparison CLI",- async () => {- const root = await fixture();+ async ({ cli }) => {+ const root = await createTestTempDirectory("rea-process-cli-");const guide = await readFile(new URL("../../../docs/process-capture.md", import.meta.url),"utf8",@@ -62,24 +50,23 @@ describe("documented process CLI workflow", () => {arguments: ["-e", "process.stdout.write('documented-capture')"],}),);- const cli = fileURLToPath(- new URL("../../../scripts/rea.mjs", import.meta.url),- );- const capture = await execFileAsync(- process.execPath,- [cli, "capture-process", ...args],- { cwd: root },- );- expect(JSON.parse(capture.stdout)).toMatchObject({+ const capture = await cli.run({+ arguments: ["capture-process", ...args],+ cwd: root,+ });+ expect(capture.exitCode, capture.stdout || capture.stderr).toBe(0);+ expect(capture.json).toMatchObject({operation: "capture_process_scenario",});await writeFile(join(root, output), capture.stdout);- const comparison = await execFileAsync(- process.execPath,- [cli, "compare-process-captures", output, output, "--json"],- { cwd: root },+ const comparison = await cli.run({+ arguments: ["compare-process-captures", output, output, "--json"],+ cwd: root,+ });+ expect(comparison.exitCode, comparison.stdout || comparison.stderr).toBe(+ 0,);- expect(JSON.parse(comparison.stdout)).toMatchObject({+ expect(comparison.json).toMatchObject({operation: "compare_process_captures",});},@@ -106,7 +93,7 @@ describe("process CLI errors", () => {);it("rejects NUL arguments before process launch", async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const scenario = join(root, "nul-argument.json");await writeFile(scenario,@@ -135,7 +122,7 @@ describe("process CLI errors", () => {describe("process CLI environment key diagnostics", () => {it("reports the reserved process environment key constraint", async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const scenario = join(root, "reserved-environment.json");await writeFile(scenario,@@ -190,7 +177,7 @@ describe("process CLI evidence validation", () => {});it("captures the minimal executable-and-arguments scenario", async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const scenario = join(root, "scenario.json");await writeFile(scenario,@@ -208,7 +195,7 @@ describe("process CLI evidence validation", () => {});it("rejects unrelated capture evidence", async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const invalidCapture = join(root, "invalid-capture.json");const unrelated = join(root, "unrelated.json");await writeFile(@@ -249,7 +236,7 @@ describe("process CLI evidence validation", () => {});it("classifies malformed capture evidence as invalid input", async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const malformed = join(root, "malformed-evidence.json");await writeFile(malformed, "{}");@@ -275,7 +262,7 @@ describe("process CLI evidence validation", () => {it("reports the JSON depth constraint through the compiled comparison CLI",async () => {- const root = await fixture();+ const root = await createTestTempDirectory("rea-process-cli-");const left = join(root, "left.json");const right = join(root, "right.json");const input = INVESTIGATION_EXAMPLES.compare_process_captures.input;