mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 17:44:27 +00:00
* feat(javascript)!: require the runtime parse-failure count and active Electron execution paths The V8 Inspector projection always writes scripts.parse_failed_total and the active Electron service always commits parameters.resolved_paths, so both are now required. Runtime reconciliation reads the admitted execution paths only and no longer falls back to request-spelled paths in parameters, and checks the observed executable path against them on every capture. JavaScriptStaticAnalysis.routes and module_runtime keep their omission, which current producers still make (a checkpoint that cannot retain route facts; no recovered factory runtime); their comments now say so instead of naming historical analyses. BREAKING CHANGE: JavaScript runtime observations without scripts.parse_failed_total, and active Electron Evidence without parameters.resolved_paths, are refused as malformed; recreate the observation. * test(javascript): give the shared Node reconciliation fixture the required parse-failure count * feat(browser)!: require browser observation facts their producers always write (#10991) * feat(browser)!: require browser observation facts their producers always write The source-map fetcher always writes effective_url (string or null), the web bundle analyzer always writes schema_property_names_coverage, and the CDP storage fingerprinter always marks IndexedDB schema fingerprints with projection_version 2. Each is now required. The IndexedDB marker is tied to its scope by a discriminated union and derived from the scope in the producer, so compare_web_captures no longer carries the store-only projection branch. response_identity and the WebMCP consequential hint keep their omission, which current producers still make (a body not fully read; an invalid annotation); the guide no longer attributes it to historical captures. BREAKING CHANGE: source-map items without effective_url, WebMCP declarations without schema_property_names_coverage, and IndexedDB schema fingerprints without projection_version are refused as malformed; recreate the capture. * feat(managed)!: refuse members beside a null signature resolution (#10992) * feat(managed)!: refuse members beside a null signature resolution signature_resolution is null only when member decoding exceeded capacity, and the capacity-recovery producer then examines no members. The managed member inspection schema now enforces that: a null resolution with any field, method, member reference, call edge or field access is malformed. With that rule, every admitted inspection with members attests type-name resolution, so the raw-digest fallback is unreachable and is deleted: comparableSides, hasSignatureResolution, the comparison's signatureResolutionExamined flag and the "does not attest" limitation. The shared workflow example that carried resolved digests beside a null attestation now attests resolution. BREAKING CHANGE: managed member Evidence with a null signature_resolution and any examined member is refused as malformed; recreate the observation. * docs: describe historical Evidence by what the format revision now refuses (#10993) SQLite worker_timeout_ms is required, so the SQLite guide no longer reads a missing value as unknown settings. The IL2CPP, ESP image and process capture guides now say that bundles exported without evidence_format are refused, while a standalone record from an earlier release is still read with the stated omission semantics (records carry no format marker yet). The route inventory guide describes a parent without route_inventory by its meaning rather than by its age. * refactor(javascript): require static analysis coverage from the JavaScript worker (#11001) * refactor(javascript): require static analysis coverage from the JavaScript worker Both JavaScript static producers always write analysis_coverage: the analyzer measures it on every parsed source and the failed-parse result carries an unexamined coverage. The worker schema and the static analysis type therefore require it, the preload-discovery checkpoint copies it unconditionally, and ElectronBoundaryAnalysis reads Electron applicability and examination limits from it alone. The fallback that re-derived Electron use from semantic module links and retained references for analyses without coverage is deleted, as are the graph and builder branches for a missing coverage. Retained Evidence graph observations are unchanged: the analysis view still counts a stored JavaScript observation without analysis_coverage as unmeasured, since standalone records carry no format marker yet. The worker runs from the same build as its parent, so no external caller sees the stricter reply schema. * feat(browser)!: require storage fingerprint, Link context, mapping index and invalid-map identity facts (#11002) * feat(browser)!: require storage fingerprint, Link context, mapping index and invalid-map identity facts Each field is written by its only producer on every capture: - The CDP storage capture always writes content_fingerprints, fingerprint_algorithm and fingerprints_complete, so their schema defaults are removed. - The CDP Link header projection always writes context_url and context_scope, so they are required. - The source-map fetcher writes source_index and declaration_index on every mapping row, so they are required. - The fetcher judges a map invalid only after reading its complete body. A separate invalidSourceMapItem builder now takes the response identity as a required argument, and the schema's invalid member requires response_identity; fetch_failed keeps it optional because those rows can come from a body that was not fully read. The browser and source-location guides no longer describe these fields as optional for older saved captures. BREAKING CHANGE: page inspections without the storage fingerprint fields or Link context fields, source-map mapping rows without their indexes, and invalid source-map items without response_identity are refused as malformed; recreate the capture. * test(browser): keep source-omission coverage on a still-defaulted field and refuse a missing fingerprint algorithm * feat(browser)!: require web-bundle target origin, inspection producer facts, scenario redirect state and exclusion kind (#11014) feat(browser)!: require web-bundle target origin, page inspection producer facts, scenario redirect state and exclusion kind Each field is written by its only producer on every record: - buildCaptureObservation always writes capture.target_origin (the validated origin or null), so analyze_web_bundle Evidence and both web-bundle view results require it; the view's conditional spread is gone. - The CDP page capture always writes accessibility node states, script frame_id (null when unattributed) and worker opener_target_id and parent_frame_id, so their schema defaults are removed. - PlaywrightScenarioNetwork writes redirected_from_transaction_state exactly when the predecessor ID is null, so request events now require it there and still refuse it on linked events. - The reference-source importer writes entry_kind on every exclusion (unknown when the kind was not observed), so it is required. The browser scenario contract and CLI guide no longer describe older captures or exclusions without these fields. BREAKING CHANGE: web-bundle analyses without capture.target_origin, page inspections without these script, accessibility or worker fields, scenario network events with a null predecessor and no redirect state, and reference source graphs whose exclusions lack entry_kind are refused as malformed; recreate the capture or re-import the source.
447 lines
16 KiB
TypeScript
447 lines
16 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import type { ArtifactInventorySnapshot } from "../../domain/artifactInventorySnapshot.js";
|
|
import type { JavaScriptArtifactFile } from "../../domain/javascript/javascriptArtifactFiles.js";
|
|
import { projectJavaScriptModuleSemantics } from "../../domain/javascript/javascriptModuleSemanticIr.js";
|
|
import { moduleResolutionModeForJavaScriptReference } from "../../domain/javascript/javascriptModuleResolutionMode.js";
|
|
import { analyzeParsedJavaScriptSemanticsSteps } from "../../domain/javascript/javascriptSemanticAnalysis.js";
|
|
import { parseJavaScriptSource } from "../../domain/javascript/javascriptSourceParser.js";
|
|
import { analyzeParsedJavaScriptStaticSourceSteps } from "../../domain/javascript/javascriptStaticAnalysis.js";
|
|
import { AnalysisResourceConstraintError } from "../../domain/analysisErrorCore.js";
|
|
import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
|
|
import type {
|
|
AnalyzedJavaScriptArtifactFile,
|
|
JavaScriptArtifactAnalysis,
|
|
} from "./JavaScriptArtifactAnalysisTypes.js";
|
|
import { javascriptArtifactAnalysisScopes } from "./JavaScriptArtifactAnalysisTypes.js";
|
|
import { completeJavaScriptAnalysisSteps } from "./JavaScriptAnalysisControl.js";
|
|
import { buildImmutableJavaScriptArtifactGraphSteps as buildGraph } from "./JavaScriptArtifactGraphBuilder.js";
|
|
import { JavaScriptJsonDocuments } from "./JavaScriptJsonDocuments.js";
|
|
|
|
const SHA256 = "a".repeat(64);
|
|
const PATH = "main.js";
|
|
|
|
const EMPTY_COVERAGE =
|
|
"Electron modules are referenced but no Electron boundary fact was recovered from inert syntax. Zero IPC operations and zero BrowserWindows here mean empty coverage, not evidence that the application has none.";
|
|
|
|
const fileFor = (
|
|
source: string,
|
|
path: string = PATH,
|
|
): JavaScriptArtifactFile => ({
|
|
path,
|
|
container_sha256: SHA256,
|
|
sha256: SHA256,
|
|
bytes: source.length,
|
|
inventory_artifact_id: `art_${SHA256}`,
|
|
kind: "javascript",
|
|
unpacked: false,
|
|
text: { included: true, value: source },
|
|
});
|
|
|
|
const analyzedEntry = async (
|
|
source: string,
|
|
path: string = PATH,
|
|
): Promise<AnalyzedJavaScriptArtifactFile> => {
|
|
const file = fileFor(source, path);
|
|
const parsed = parseJavaScriptSource(source, path);
|
|
if (parsed === null) throw new Error("expected a parsed source");
|
|
const facts = await completeJavaScriptAnalysisSteps(
|
|
analyzeParsedJavaScriptStaticSourceSteps(source, parsed),
|
|
);
|
|
const ir = await completeJavaScriptAnalysisSteps(
|
|
analyzeParsedJavaScriptSemanticsSteps(
|
|
parsed,
|
|
moduleResolutionModeForJavaScriptReference(path, "static-import"),
|
|
100_000,
|
|
),
|
|
);
|
|
return {
|
|
file,
|
|
javascript: facts,
|
|
semantic: { ir: projectJavaScriptModuleSemantics(ir) },
|
|
};
|
|
};
|
|
|
|
const snapshot = {
|
|
manifest: {
|
|
root_artifact_id: `art_${SHA256}`,
|
|
root_sha256: SHA256,
|
|
root_format: "directory",
|
|
manifest_id: `agm_${SHA256}`,
|
|
graph_sha256: SHA256,
|
|
},
|
|
nodes: [{ artifact_id: `art_${SHA256}`, sha256: SHA256, size: 1 }],
|
|
occurrences: [],
|
|
limitations: [],
|
|
integrity_contradictions: [],
|
|
coverage: { scope: "root", status: "complete" },
|
|
} as unknown as ArtifactInventorySnapshot;
|
|
|
|
const graphFor = async (
|
|
source: string,
|
|
mutate?: (
|
|
entry: AnalyzedJavaScriptArtifactFile,
|
|
) => AnalyzedJavaScriptArtifactFile,
|
|
path: string = PATH,
|
|
): Promise<{
|
|
limitations: readonly string[];
|
|
electronSemantics: string | undefined;
|
|
}> => {
|
|
const base = await analyzedEntry(source, path);
|
|
return graphForEntries([mutate === undefined ? base : mutate(base)]);
|
|
};
|
|
|
|
const graphForEntries = (
|
|
entries: readonly AnalyzedJavaScriptArtifactFile[],
|
|
): {
|
|
limitations: readonly string[];
|
|
electronSemantics: string | undefined;
|
|
browserWindows: number;
|
|
} => {
|
|
const analysis: JavaScriptArtifactAnalysis = {
|
|
jsonDocuments: new JavaScriptJsonDocuments(),
|
|
files: [...entries],
|
|
packages: [],
|
|
json_modules: [],
|
|
html_scripts: [],
|
|
html_inline_scripts: [],
|
|
source_maps: [],
|
|
visited_ast_nodes: 0,
|
|
findings: 0,
|
|
modules: 0,
|
|
parse_failures: 0,
|
|
limitations: [],
|
|
};
|
|
const fileSet = {
|
|
files: entries.map(({ file }) => file),
|
|
unavailable_relevant_files: [],
|
|
containers: [],
|
|
text_bytes_read: entries.reduce((total, { file }) => total + file.bytes, 0),
|
|
invalid_utf8_files: 0,
|
|
};
|
|
const steps = buildGraph(snapshot, fileSet, analysis);
|
|
let next = steps.next();
|
|
while (next.done !== true) next = steps.next();
|
|
return {
|
|
limitations: next.value.graph.limitations,
|
|
electronSemantics: next.value.electronSummary.electron_semantics,
|
|
browserWindows: next.value.electronSummary.browser_windows,
|
|
};
|
|
};
|
|
|
|
describe("Electron semantic coverage", () => {
|
|
it.each(["main.js", "main.MJS"])(
|
|
"does not present candidate Electron boundaries as proven coverage for %s",
|
|
async (path) => {
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
'const { BrowserWindow } = require("electron"); new BrowserWindow();',
|
|
undefined,
|
|
path,
|
|
);
|
|
expect(electronSemantics).toBeUndefined();
|
|
expect(limitations.join(" ")).toContain("Conditional Electron findings");
|
|
expect(limitations).not.toContain(EMPTY_COVERAGE);
|
|
},
|
|
);
|
|
|
|
it("reports empty Electron coverage when the module is referenced but nothing is recovered", async () => {
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`const { app } = require("electron");\napp.whenReady();\n`,
|
|
undefined,
|
|
"main.cjs",
|
|
);
|
|
expect(limitations).toContain(EMPTY_COVERAGE);
|
|
expect(electronSemantics).toBe("empty");
|
|
});
|
|
|
|
it("reports idle-coverage limits, not empty coverage, once a boundary fact is recovered", async () => {
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`const { ipcMain } = require("electron");\nipcMain.handle("ping", () => 1);\n`,
|
|
undefined,
|
|
"main.cjs",
|
|
);
|
|
expect(limitations).not.toContain(EMPTY_COVERAGE);
|
|
expect(limitations).toContainEqual(
|
|
expect.stringMatching(
|
|
/inert syntax.*runtime registration.*reachability.*defaults.*enforcement.*unproven/iu,
|
|
),
|
|
);
|
|
expect(electronSemantics).toBe("recovered");
|
|
});
|
|
|
|
it("omits the coverage field when the source never references Electron", async () => {
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`export const value = 1;\n`,
|
|
);
|
|
expect(limitations).not.toContain(EMPTY_COVERAGE);
|
|
expect(electronSemantics).toBeUndefined();
|
|
});
|
|
|
|
it("does not count a type-only Electron import as boundary coverage", async () => {
|
|
const result = await graphFor(
|
|
'import type { BrowserWindow } from "electron";\nexport type Window = BrowserWindow;\n',
|
|
undefined,
|
|
"main.ts",
|
|
);
|
|
expect(result.electronSemantics).toBeUndefined();
|
|
expect(result.limitations).not.toContain(EMPTY_COVERAGE);
|
|
});
|
|
|
|
it("matches a supported Electron subpath and ignores an unrelated package", async () => {
|
|
const subpath = await graphFor(
|
|
`const { app } = require("electron/main");\napp.whenReady();\n`,
|
|
undefined,
|
|
"main.cjs",
|
|
);
|
|
expect(subpath.electronSemantics).toBe("empty");
|
|
const unrelated = await graphFor(
|
|
`const helper = require("electron-helper");\nhelper.run();\n`,
|
|
);
|
|
expect(unrelated.electronSemantics).toBeUndefined();
|
|
});
|
|
|
|
it("keeps the coverage state when a rejected projection drops the file", async () => {
|
|
// A file whose expanded relationships exceed the result budget is replaced
|
|
// by a placeholder before the Electron summary runs, so the coverage state
|
|
// must come from the retained analysis rather than the projected view.
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`const { app } = require("electron");\napp.whenReady();\n`,
|
|
(entry) => ({
|
|
...entry,
|
|
application_projection_failure: {
|
|
reason: "result budget exhausted",
|
|
error: { code: "result_budget_exhausted" },
|
|
limits: null,
|
|
},
|
|
}),
|
|
"main.cjs",
|
|
);
|
|
expect(electronSemantics).toBe("empty");
|
|
expect(limitations).toContain(EMPTY_COVERAGE);
|
|
});
|
|
|
|
it("counts a retained static reference when semantic analysis was skipped", async () => {
|
|
// Semantic analysis can be skipped for a budget, which leaves the module
|
|
// links absent while the static reference is still retained.
|
|
const { electronSemantics } = await graphFor(
|
|
`const { app } = require("electron");\napp.whenReady();\n`,
|
|
(entry) => ({
|
|
...entry,
|
|
semantic: null,
|
|
}),
|
|
"main.cjs",
|
|
);
|
|
expect(electronSemantics).toBe("empty");
|
|
});
|
|
});
|
|
|
|
it("counts a dynamic Electron import that module links do not retain", async () => {
|
|
// The semantic collector keeps no module link for `import("electron")`, so
|
|
// only the retained static reference names Electron here.
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`const electron = import("electron");\nelectron.then(() => {});\n`,
|
|
);
|
|
expect(electronSemantics).toBe("empty");
|
|
expect(limitations).toContain(EMPTY_COVERAGE);
|
|
});
|
|
|
|
it("counts a retained runtime static import when semantics are skipped", async () => {
|
|
// The static analyzer records a whole `import type` declaration as no
|
|
// reference, so a retained `static-import` is a runtime load.
|
|
const { electronSemantics } = await graphFor(
|
|
`import { app } from "electron";\napp.whenReady();\n`,
|
|
(entry) => ({ ...entry, semantic: null }),
|
|
);
|
|
expect(electronSemantics).toBe("empty");
|
|
});
|
|
|
|
it("does not count a whole type-only import when semantics are skipped", async () => {
|
|
// `import type` needs a TypeScript source, and the static analyzer records no
|
|
// reference for a whole type-only declaration.
|
|
const { electronSemantics } = await graphFor(
|
|
`import type { IpcMain } from "electron";\nexport const value = 1;\n`,
|
|
(entry) => ({ ...entry, semantic: null }),
|
|
"main.mts",
|
|
);
|
|
expect(electronSemantics).toBeUndefined();
|
|
});
|
|
|
|
it("does not treat a worker URL path as an Electron module", async () => {
|
|
// `new Worker(new URL("electron", import.meta.url))` records a `worker`
|
|
// reference whose specifier is a path relative to the importing source.
|
|
const { electronSemantics } = await graphFor(
|
|
`const worker = new Worker(new URL("electron", import.meta.url));\n`,
|
|
(entry) => ({ ...entry, semantic: null }),
|
|
);
|
|
expect(electronSemantics).toBeUndefined();
|
|
});
|
|
|
|
it("reports the same Electron applicability as the retained static fact", async () => {
|
|
// `analysis_coverage.applicability.electron` is the domain owner of the same
|
|
// question, so a worker URL path must be unknown for both outputs.
|
|
|
|
const entry = await analyzedEntry(
|
|
`const worker = new Worker(new URL("electron", import.meta.url));\n`,
|
|
);
|
|
expect(entry.javascript?.analysis_coverage.applicability.electron).toBe(
|
|
"unknown",
|
|
);
|
|
const graph = await graphFor(
|
|
`const worker = new Worker(new URL("electron", import.meta.url));\n`,
|
|
);
|
|
expect(graph.electronSemantics).toBeUndefined();
|
|
});
|
|
|
|
it("does not count a resolve-only Electron reference as coverage", async () => {
|
|
// `require.resolve("electron")` locates the module without loading it, so no
|
|
// boundary fact is expected and neither output may claim empty coverage.
|
|
const { limitations, electronSemantics } = await graphFor(
|
|
`const entry = require.resolve("electron");\n`,
|
|
);
|
|
expect(electronSemantics).toBeUndefined();
|
|
expect(limitations).not.toContain(EMPTY_COVERAGE);
|
|
});
|
|
|
|
it("classifies a bundle module by its loader, not by its name", async () => {
|
|
// A Webpack/Rspack factory can name a local module `"electron"`. A
|
|
// `factory-loader` reference names that module key, while a real external load
|
|
// keeps its `commonjs-loader` identity even in the same file.
|
|
const shell = (modules: string, consumer: string) =>
|
|
`(()=>{var m={${modules}},c={};` +
|
|
`function n(t){var r=c[t];if(void 0!==r)return r.exports;var o=c[t]={exports:{}};` +
|
|
`return m[t](o,o.exports,n),o.exports}${consumer}})();`;
|
|
|
|
const local = await graphFor(
|
|
shell(
|
|
`"electron":(e,t,n)=>{"use strict";e.exports={local:1}},` +
|
|
`100:(e,t,n)=>{"use strict";const s=n("electron");s.local}`,
|
|
`n(100);`,
|
|
),
|
|
);
|
|
expect(local.electronSemantics).toBeUndefined();
|
|
expect(local.limitations).not.toContain(EMPTY_COVERAGE);
|
|
|
|
const external = await graphFor(
|
|
shell(
|
|
`45840:e=>{"use strict";e.exports=require("electron")},` +
|
|
`100:(e,t,n)=>{"use strict";const s=n(45840);s.ipcMain.handle("x",()=>1)}`,
|
|
`n(100);`,
|
|
),
|
|
undefined,
|
|
"main.cjs",
|
|
);
|
|
expect(external.electronSemantics).toBe("recovered");
|
|
|
|
// A factory keyed `"electron"` whose body loads the real package is still a
|
|
// real load, so the name alone must not suppress it.
|
|
const externalUnderKey = await graphFor(
|
|
shell(
|
|
`"electron":(e,t,n)=>{"use strict";e.exports=require("electron")},` +
|
|
`100:(e,t,n)=>{"use strict";const s=n("electron");s.ipcMain.handle("x",()=>1)}`,
|
|
`n(100);`,
|
|
),
|
|
undefined,
|
|
"main.cjs",
|
|
);
|
|
expect(externalUnderKey.electronSemantics).toBe("recovered");
|
|
});
|
|
|
|
it("reports partial coverage when an Electron source was dropped for the result budget", async () => {
|
|
// #9321: IPC handlers from an admitted source were reported while the
|
|
// window source's projection was rejected, so zero windows is unknown.
|
|
const reported = await analyzedEntry(
|
|
`const electron = require("electron");\nelectron.ipcMain.handle("ping", () => "pong");\n`,
|
|
"out/main/ipc.cjs",
|
|
);
|
|
const window = await analyzedEntry(
|
|
`const electron = require("electron");\nnew electron.BrowserWindow({ webPreferences: { contextIsolation: true } });\n`,
|
|
"out/main/window.cjs",
|
|
);
|
|
expect(window.javascript?.electron.browser_windows).toHaveLength(1);
|
|
const complete = graphForEntries([reported, window]);
|
|
expect(complete.electronSemantics).toBe("recovered");
|
|
expect(complete.browserWindows).toBe(1);
|
|
|
|
const notStarted = new AnalysisResourceConstraintError(
|
|
"analyze_javascript_application",
|
|
"memory",
|
|
"semantic analysis of out/main/window.cjs was not started",
|
|
{ semantic_result_budget_bytes: 0 },
|
|
);
|
|
const dropped: AnalyzedJavaScriptArtifactFile[] = [
|
|
{
|
|
...window,
|
|
application_projection_failure: {
|
|
reason: "result budget exhausted",
|
|
error: projectAnalysisError(notStarted),
|
|
limits: null,
|
|
},
|
|
},
|
|
{
|
|
...window,
|
|
semantic: null,
|
|
analysis_failure: {
|
|
scope: javascriptArtifactAnalysisScopes.javascript,
|
|
status: "interrupted",
|
|
reason: `out/main/window.cjs: ${notStarted.message}`,
|
|
error: projectAnalysisError(notStarted),
|
|
limits: notStarted.reportedLimits,
|
|
},
|
|
},
|
|
];
|
|
for (const entry of dropped) {
|
|
const partial = graphForEntries([reported, entry]);
|
|
expect(partial.electronSemantics).toBe("partial");
|
|
expect(partial.limitations).not.toContain(EMPTY_COVERAGE);
|
|
expect(partial.limitations).toContainEqual(
|
|
expect.stringContaining(
|
|
"Electron boundary facts are partial: 1 Electron-loading source(s)",
|
|
),
|
|
);
|
|
}
|
|
});
|
|
|
|
it("reports partial coverage when a successful static pass stopped at a limit", async () => {
|
|
// The wrapper expansion budget ends Electron call-path discovery without
|
|
// failing the worker, so no failure field marks the source as incomplete.
|
|
const { electronSemantics, limitations } = await graphFor(
|
|
`const electron = require("electron");\nelectron.ipcMain.handle("ping", () => "pong");\n`,
|
|
(entry) => {
|
|
const javascript = entry.javascript!;
|
|
const coverage = javascript.analysis_coverage;
|
|
return {
|
|
...entry,
|
|
javascript: {
|
|
...javascript,
|
|
analysis_coverage: {
|
|
...coverage,
|
|
examination: {
|
|
...coverage.examination,
|
|
status: "limited",
|
|
electron_call_paths_limited: true,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
},
|
|
"main.cjs",
|
|
);
|
|
expect(electronSemantics).toBe("partial");
|
|
expect(limitations).toContainEqual(
|
|
expect.stringContaining(
|
|
"Electron boundary facts are partial: 1 Electron-loading source(s)",
|
|
),
|
|
);
|
|
});
|
|
|
|
it("keeps recovered Electron facts partial after syntax recovery", async () => {
|
|
const source = `import { BrowserWindow } from "electron"; new BrowserWindow({webPreferences: {sandbox: true}}); const duplicate = 1; const duplicate = 2;`;
|
|
const entry = await analyzedEntry(source, "main.mjs");
|
|
expect(entry.javascript?.parse_status).toBe("partial");
|
|
expect(entry.javascript?.electron.browser_windows.length).toBeGreaterThan(0);
|
|
expect(graphForEntries([entry])).toMatchObject({
|
|
electronSemantics: "partial",
|
|
browserWindows: 1,
|
|
});
|
|
});
|