mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +00:00
* fix(javascript): require exact loader suffix case * fix(javascript): share exact loader mode across import resolution * test(process): align symlink fixture with filesystem checkpoints * test(javascript): normalize the module resolution oracle path separators * test(frida): assert the CLI spawn Evidence contract * test(mcp): use an unsupported analysis-view parent * test(browser): separate source-location line bounds from parity * fix(javascript): preserve uncertain loader provenance * test(javascript): cover uncertain require resolution * fix(javascript): retain conditional Electron evidence * fix(javascript): preserve timed semantic provenance * fix(javascript): retain conditional builtin effects * test(javascript): distinguish bundled host authority * fix(javascript): preserve nested loader invocation identity * test(javascript): qualify Electron fixture authority * fix(javascript): preserve loader invocation authority * fix(javascript): respect source order for resolver escapes * fix(javascript): check nested loader callable mutations * fix(javascript): retain conditional constructor requests * fix(reference): retain constructor loader relationships * fix(reference): follow nested loader callable paths * refactor(javascript): share callable mutation interpretation * fix(javascript): require exact package loader suffixes * refactor(javascript): unify conditional relation evidence * refactor(javascript): unify conditional node evidence * fix(javascript): retain unknown authority for mixed case sources * fix(javascript): preserve loader uncertainty for dotfiles * fix(reference): classify javascript suffix dotfiles * test(reference): cover suffix dotfiles through cli * fix(javascript): retain equivalent conditional built-in origins * fix(javascript): preserve wrapped resolver operation * fix(javascript): retain nested conditional built-in receivers * test(javascript): declare CommonJS in native addon fixtures * fix(javascript): retain wrapped resolver candidates * style: format merged native command schema * fix(javascript): preserve uncertain loader authority * test(javascript): require candidate preload evidence * test(javascript): cover reference loader member writes --------- Co-authored-by: ShuaixinHuang <1836656514@qq.com>
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { analyzeJavaScriptStaticSource } from "./javascriptStaticAnalysis.js";
|
|
|
|
describe("computed Electron web preference keys", () => {
|
|
it("retains exact string, numeric, and empty literal keys", () => {
|
|
const analysis = analyzeJavaScriptStaticSource(`
|
|
const { BrowserWindow } = require("electron");
|
|
new BrowserWindow({ webPreferences: {
|
|
["sandbox"]: true,
|
|
["preload"]: "./preload.js",
|
|
[1]: "numeric",
|
|
[""]: false
|
|
} });
|
|
`);
|
|
|
|
expect(analysis.parse_status).toBe("partial");
|
|
expect(analysis.analysis_coverage?.syntax).toEqual({
|
|
status: "complete",
|
|
error_count: 0,
|
|
});
|
|
expect(analysis.electron.browser_windows[0]).toMatchObject({
|
|
loader_authority: "candidate",
|
|
preload_path: "./preload.js",
|
|
web_preferences: [
|
|
{ name: "", value: { status: "literal", value: false } },
|
|
{ name: "1", value: { status: "literal", value: "numeric" } },
|
|
{
|
|
name: "preload",
|
|
value: { status: "literal", value: "./preload.js" },
|
|
},
|
|
{ name: "sandbox", value: { status: "literal", value: true } },
|
|
],
|
|
});
|
|
});
|
|
|
|
it("keeps genuinely dynamic computed keys unknown", () => {
|
|
const analysis = analyzeJavaScriptStaticSource(`
|
|
const { BrowserWindow } = require("electron");
|
|
new BrowserWindow({ webPreferences: {
|
|
[getKey()]: true,
|
|
["sandbox"]: true
|
|
} });
|
|
`);
|
|
|
|
expect(analysis.parse_status).toBe("partial");
|
|
expect(analysis.electron.browser_windows[0]?.web_preferences).toEqual(
|
|
expect.arrayContaining([
|
|
expect.objectContaining({
|
|
name: expect.stringMatching(/^\[dynamic@/u),
|
|
value: expect.objectContaining({ status: "dynamic" }),
|
|
}),
|
|
{
|
|
name: "sandbox",
|
|
value: { status: "literal", value: true, expression: null },
|
|
},
|
|
]),
|
|
);
|
|
});
|
|
});
|