fix(browser): preserve evidence through deep AST analysis (#924)
This commit is contained in:
@@ -301,6 +301,32 @@ describe("web bundle artifact metadata", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("deep captured web bundle syntax", () => {
|
||||
it("retains evidence after a parser-admitted deep property chain", () => {
|
||||
const source = `const value = root${".next".repeat(12_000)};\nimport "./last.js";\nfetch("/after");`;
|
||||
const result = analyzeCapturedWebBundle(inspection(source));
|
||||
expect(result.completeness).toMatchObject({
|
||||
status: "complete",
|
||||
parsed_scripts: 1,
|
||||
parse_failures: 0,
|
||||
});
|
||||
expect(result.observations.chunks.edges).toContainEqual(
|
||||
expect.objectContaining({
|
||||
kind: "static_import",
|
||||
specifier: "./last.js",
|
||||
resolved_url: `${origin}/assets/last.js`,
|
||||
location: expect.objectContaining({ line: 2, column: 0 }),
|
||||
}),
|
||||
);
|
||||
expect(result.observations.endpoints).toContainEqual(
|
||||
expect.objectContaining({
|
||||
value: "/after",
|
||||
location: expect.objectContaining({ line: 3, column: 0 }),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const inspection = (source: string) =>
|
||||
webPageInspectionSchema.parse({
|
||||
browser: {
|
||||
|
||||
Reference in New Issue
Block a user