gs-prune-tests
Prune every test that guards no behavior.
The examples are TypeScript. The rules apply to any language and any test framework.
0. Pick the scope and get a green baseline
The user names the scope in prose. With a path, file, or module, work there. With none, work on the test files the current branch touched compared with the default branch, including uncommitted changes, and tell the user that is the scope. Find the default branch with git symbolic-ref --short refs/remotes/origin/HEAD, then git remote show origin, then main. Prune the whole repo only when the user asks for it.
Run the tests before you change anything. Use the project's own test command, and run the full suite when it is fast enough. Otherwise run the tests in scope and the tests for any production code you might delete. If anything fails, stop and report the failures. A red baseline hides which failures the prune caused.
1. Find the bad tests
When the user hands you a report that gs-find-bad-tests already made, work from it. Check first that each test it names still exists as the report describes it.
Otherwise use gs-find-bad-tests on the same scope when it is installed, and work from its report. Without it, apply this short rule.
Keep a test only if it depends on the intended behavior: it should change only when that behavior changes, and fail only when it regresses. A bad test falls into one of four categories: