fix(scripts): allow .prettierignore in coverage diff gate

.prettierignore is a config file with no executable code. Without this
allowlist entry, pnpm coverage:diff fails with no-coverage-data when
.prettierignore is part of the diff.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 20:08:24 +00:00
parent b69c5a2112
commit 7d3125627c
2 changed files with 13 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ const ALLOWED_GLOBS = [
/\.json$/,
/\.ya?ml$/,
/\.gitignore$/,
/\.prettierignore$/,
/\.npmrc$/,
/(^|\/)\.env(\.[^/]+)?$/, // .env, .env.example, .env.local, etc.
// Shell scripts (not Vitest-covered)

View File

@@ -171,6 +171,18 @@ describe("computeDiffCoverage", () => {
assert.equal(result.summary.filesChanged, 2);
});
test("skips dotfile ignore configs (.prettierignore, .gitignore)", () => {
const lcov = parseLcov(lcovText);
const diff = new Map([
[".prettierignore", new Set([1, 2])],
[".gitignore", new Set([1])],
]);
const result = computeDiffCoverage(diff, lcov);
assert.equal(result.status, "pass");
assert.equal(result.summary.filesGated, 0);
assert.equal(result.summary.filesChanged, 2);
});
test("skips .env template files (.env, .env.example, .env.local)", () => {
const lcov = parseLcov(lcovText);
const diff = new Map([