fix(reference): preserve distinct parse failures
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
createHistoricalSourceGraph,
|
||||
createHistoricalSourceManifest,
|
||||
historicalSourceGraphSchema,
|
||||
historicalSourceParseFailureKey,
|
||||
parseHistoricalSourceGraph,
|
||||
parseHistoricalSourceManifest,
|
||||
type HistoricalSourceGraphInput,
|
||||
@@ -192,6 +193,29 @@ describe("historical source graph", () => {
|
||||
).toThrow(/Complete inventory/u);
|
||||
});
|
||||
|
||||
it("keeps distinct parse failure reasons for the same path and parser", () => {
|
||||
const input = graphInput();
|
||||
const malformed = {
|
||||
path: "src/main.ts",
|
||||
parser: "typescript",
|
||||
reason: "Malformed input",
|
||||
};
|
||||
const unexpected = {
|
||||
path: "src/main.ts",
|
||||
parser: "typescript",
|
||||
reason: "Unexpected token",
|
||||
};
|
||||
input.inventory_state = "partial";
|
||||
input.parse_failures = [malformed, unexpected];
|
||||
|
||||
expect(createHistoricalSourceGraph(input).parse_failures).toEqual(
|
||||
input.parse_failures,
|
||||
);
|
||||
expect(historicalSourceParseFailureKey(malformed)).not.toBe(
|
||||
historicalSourceParseFailureKey(unexpected),
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects strict unknown fields, invalid VCS, dangling internal edges, and false manifests", () => {
|
||||
expect(() =>
|
||||
createHistoricalSourceGraph({ ...graphInput(), surprise: true }),
|
||||
|
||||
Reference in New Issue
Block a user