mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
2612e474b6
Reuse semantic module provenance for aliases and keep property path segments intact through Electron matching. Reject shadowed names and nested or dotted lookalikes. Reassigned and conditionally initialized module origins remain ambiguous, with their source origins retained. Add a compiled CLI/stdio MCP regression for windows, preloads, context bridges, IPC operations, pairing, and source ranges. Validate 771 JavaScript domain tests, seven composition tests, the public acceptance workflow, build, and check:fast. Fixes #1656
41 lines
1.6 KiB
TypeScript
41 lines
1.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { analyzeJavaScriptStaticSource } from "./javascriptStaticAnalysis.js";
|
|
|
|
describe("JavaScript static analysis findings", () => {
|
|
it("does not infer a webpack push from a dynamic computed key", () => {
|
|
const analysis = analyzeJavaScriptStaticSource(`
|
|
const push = "push";
|
|
const arr = {};
|
|
arr[push]([[1], { 1: function () {} }]);
|
|
`);
|
|
expect(analysis.bundler_registrations).toEqual([]);
|
|
});
|
|
|
|
it("retains every static reference and Electron property in large literals", () => {
|
|
const names = Array.from({ length: 10_001 }, (_, index) => `key${index}`);
|
|
const source = [
|
|
'const { BrowserWindow, contextBridge } = require("electron");',
|
|
...names.map(
|
|
(name, index) => `import value${index} from "./${name}.js";`,
|
|
),
|
|
`new BrowserWindow({ webPreferences: { ${names.map((name) => `${name}: true`).join(", ")} } });`,
|
|
`contextBridge.exposeInMainWorld("api", { ${names.map((name) => `${name}: () => true`).join(", ")} });`,
|
|
`const { ${names.join(", ")} } = require("./addon.node");`,
|
|
].join("\n");
|
|
const analysis = analyzeJavaScriptStaticSource(source);
|
|
|
|
expect(analysis.parse_status).toBe("complete");
|
|
expect(analysis.references).toHaveLength(10_003);
|
|
expect(analysis.electron.browser_windows[0]?.web_preferences).toHaveLength(
|
|
10_001,
|
|
);
|
|
expect(analysis.electron.context_bridge_apis[0]?.members).toHaveLength(
|
|
10_001,
|
|
);
|
|
expect(analysis.electron.native_addon_bindings[0]?.members).toHaveLength(
|
|
10_001,
|
|
);
|
|
});
|
|
});
|