fix(javascript): preserve per-field publication and provenance coverage

This commit is contained in:
morluto committed 2026-10-24 03:10:43 +08:00
1 parent 2206822109
commit f1a9d85de5
8 files changed
+185 -56

No files matched your search

@@ -0,0 +1,26 @@
import { expect, it } from "vitest";
import { analyzeJavaScriptSemantics } from "./javascriptSemanticAnalysis.js";
import { topLevelBinding } from "./javascriptSemanticAnalysis.fixture.js";
it("retains a provenance-only depth limit in canonical file coverage", () => {
const analyze = (count: number) =>
analyzeJavaScriptSemantics(
`const deep=${"a=".repeat(count)}"x"; const stable=7;`,
);
const shallow = analyze(10);
const deep = analyze(300);
expect(shallow.coverage.status).toBe("complete");
expect(deep.coverage).toMatchObject({
status: "partial",
omittedCount: null,
resourceLimits: ["expression-depth"],
});
expect(topLevelBinding(deep, "deep").provenance).toMatchObject({
status: "unknown",
reason: expect.stringContaining("depth budget"),
});
expect(topLevelBinding(deep, "stable").value).toEqual({
status: "literal",
value: 7,
});
});