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:
@@ -46,6 +46,7 @@ const ALLOWED_GLOBS = [
|
|||||||
/\.json$/,
|
/\.json$/,
|
||||||
/\.ya?ml$/,
|
/\.ya?ml$/,
|
||||||
/\.gitignore$/,
|
/\.gitignore$/,
|
||||||
|
/\.prettierignore$/,
|
||||||
/\.npmrc$/,
|
/\.npmrc$/,
|
||||||
/(^|\/)\.env(\.[^/]+)?$/, // .env, .env.example, .env.local, etc.
|
/(^|\/)\.env(\.[^/]+)?$/, // .env, .env.example, .env.local, etc.
|
||||||
// Shell scripts (not Vitest-covered)
|
// Shell scripts (not Vitest-covered)
|
||||||
|
|||||||
@@ -171,6 +171,18 @@ describe("computeDiffCoverage", () => {
|
|||||||
assert.equal(result.summary.filesChanged, 2);
|
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)", () => {
|
test("skips .env template files (.env, .env.example, .env.local)", () => {
|
||||||
const lcov = parseLcov(lcovText);
|
const lcov = parseLcov(lcovText);
|
||||||
const diff = new Map([
|
const diff = new Map([
|
||||||
|
|||||||
Reference in New Issue
Block a user