From 7d3125627c9b1f7222d0e5d0a02c92a0b34fd5d3 Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Mon, 18 May 2026 20:08:24 +0000 Subject: [PATCH] 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 --- scripts/coverage/diff.mjs | 1 + scripts/coverage/diff.test.mjs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/coverage/diff.mjs b/scripts/coverage/diff.mjs index 4259564..f290088 100644 --- a/scripts/coverage/diff.mjs +++ b/scripts/coverage/diff.mjs @@ -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) diff --git a/scripts/coverage/diff.test.mjs b/scripts/coverage/diff.test.mjs index bff9967..7ddf75e 100644 --- a/scripts/coverage/diff.test.mjs +++ b/scripts/coverage/diff.test.mjs @@ -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([