Skip to content

Commit 1f639d3

Browse files
committed
Tighten the linguist override regression so contradictions fail
The first pass only checked substring presence, which meant the test could stay green even if conflicting `.gitattributes` rules were added later. This switches that guardrail to an exact normalized line match for the override block. Constraint: Keep the fix scoped to the single actionable CodeRabbit finding on PR #389 Rejected: Add broader parser helpers or extra metadata tests | unnecessary for a five-line override contract Confidence: high Scope-risk: narrow Directive: Keep this assertion exact; if the override block changes, update the expected normalized lines in one place Tested: `npm test -- test/documentation.test.ts`; `npm run lint`; `npm run typecheck` Not-tested: Full `npm test` remains red on inherited `test/proactive-refresh.test.ts` timeouts reproduced earlier on clean `origin/main`
1 parent 276e350 commit 1f639d3

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

test/documentation.test.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,17 @@ function compareSemverDescending(left: string, right: string): number {
617617
).toBe(true);
618618

619619
const content = read(gitattributes);
620-
expect(content).toContain("*.ts linguist-detectable");
621-
expect(content).toContain("*.js -linguist-detectable");
622-
expect(content).toContain("*.mjs -linguist-detectable");
623-
expect(content).toContain("*.sh -linguist-detectable");
624-
expect(content).toContain("*.html -linguist-detectable");
620+
const normalized = content
621+
.split(/\r?\n/)
622+
.map((line) => line.trim())
623+
.filter((line) => line.length > 0 && !line.startsWith("#"));
624+
expect(normalized).toEqual([
625+
"*.ts linguist-detectable",
626+
"*.js -linguist-detectable",
627+
"*.mjs -linguist-detectable",
628+
"*.sh -linguist-detectable",
629+
"*.html -linguist-detectable",
630+
]);
625631
});
626632

627633
it("publishes maintainer runbooks for refactor-era changes", () => {

0 commit comments

Comments
 (0)