Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/scripts/pr-hygiene.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ function assessHygiene({ files = [], labels = [] }) {
const behaviorChanged = allPaths.some(
(path) => isBehaviorPath(path) && !commentOnlyPaths.has(path),
);
// Deleted tests add no coverage and must not satisfy the regression gate.
const testsChanged = allPaths.some(
// Deleted or renamed-away tests add no coverage and must not satisfy the
// regression gate. Previous paths still classify behavior and generated
// files above, but only a current test path counts as regression coverage.
const testsChanged = filenames.some(
(path) => isTestPath(path) && !removedFilenames.has(path),
);

Expand Down
13 changes: 13 additions & 0 deletions .github/scripts/pr-hygiene.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ describe("assessHygiene", () => {
assert.equal(failures[0].code, "missing_regression_test");
});

it("does not count renamed-away tests as regression coverage", () => {
const failures = assessHygiene({ files: [
{ filename: "src/router.ts", patch: "+change" },
{
filename: "docs/router.md",
previous_filename: "tests/router.test.ts",
status: "renamed",
patch: "",
},
] });
assert.equal(failures[0].code, "missing_regression_test");
});

it("allows maintainer-approved narrow exceptions", () => {
const failures = assessHygiene({
files: [
Expand Down
Loading