mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 21:36:13 +00:00
* test: strengthen integration oracles and verification * test: bound lifecycle gates and strengthen workflow checks * test: verify complete paged and extracted results * test: preserve bytecode and cancellation evidence * test: strengthen retained evidence and fixture cleanup * test: require cross-projection bridge identities * test: retain fixture owners through cleanup failures * test: verify graph examples and project selectors * test: tighten provider and lifecycle regressions * test: consolidate hex coverage and bound cutter cleanup * test: bound subprocess output waits and strengthen graph checks * test: check mcp recovery and preserve cleanup owners * test: verify structured mcp argument failures * test: preserve artifact cleanup and gdb limit evidence * test: preserve evidence identities and bound provider gates * test: retain browser and comparison cleanup owners * test: bound startup and strengthen fixture oracles * test: bound lifecycle gates and verify recovered evidence * test: verify public outcomes and lifecycle ownership * test: assert precise evidence and release lifecycle gates * test: verify selected facts and bound cleanup waits * test: check retained evidence and decoded records * test: verify final reports and retain cleanup ownership * test: bound reviewed startup gates and retain cleanup * test: verify PE errors and preserve MCP cleanup * test: preserve MCP fixture cleanup ownership * test: release provider gates before late startup
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { execFile } from "node:child_process";
|
|
import { writeFile } from "node:fs/promises";
|
|
import { join } from "node:path";
|
|
import { promisify } from "node:util";
|
|
|
|
import { expect, it } from "vitest";
|
|
|
|
import { parseEvidence } from "../../../src/domain/evidence.js";
|
|
import { javascriptApplicationAnalysisResultSchema } from "../../../src/domain/javascript/javascriptApplicationAnalysis.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
const execute = promisify(execFile);
|
|
|
|
it.each([
|
|
[
|
|
"callback",
|
|
`const task = function execute(execute) {
|
|
return execute();
|
|
}; task(() => 'CALLBACK');`,
|
|
2,
|
|
null,
|
|
],
|
|
[
|
|
"body-local",
|
|
`const task = function execute() {
|
|
var execute = () => 'LOCAL';
|
|
return execute();
|
|
}; task();`,
|
|
3,
|
|
2,
|
|
],
|
|
])(
|
|
"keeps named expression %s calls distinct in the public CLI",
|
|
async (name, source, callLine, targetLine) => {
|
|
const root = await createTestTempDirectory("rea-function-name-cli-");
|
|
await writeFile(join(root, "app.js"), source);
|
|
const { stdout } = await execute(
|
|
process.execPath,
|
|
["scripts/rea.mjs", "analyze-javascript-application", root, "--json"],
|
|
{ cwd: process.cwd(), maxBuffer: 16 * 1024 * 1024 },
|
|
);
|
|
const result = javascriptApplicationAnalysisResultSchema.parse(
|
|
parseEvidence(JSON.parse(stdout)).normalized_result,
|
|
);
|
|
const graph = result.semantic_graph;
|
|
const calls = graph.nodes.filter(
|
|
({ kind, identity }) =>
|
|
kind === "call-site" && identity.source_range?.start.line === callLine,
|
|
);
|
|
expect(calls).toHaveLength(1);
|
|
const call = calls[0]!;
|
|
const targets = graph.relations
|
|
.filter(
|
|
({ relation, source_node_id }) =>
|
|
relation === "calls" && source_node_id === call.node_id,
|
|
)
|
|
.map(
|
|
({ target_node_id }) =>
|
|
graph.nodes.find(({ node_id }) => node_id === target_node_id)
|
|
?.identity.source_range?.start.line,
|
|
);
|
|
expect(targets).toEqual(targetLine === null ? [] : [targetLine]);
|
|
},
|
|
20_000,
|
|
);
|