passsy / good-commit-messagesr2
Good Commit Messages
PublicWrite a short, capitalized, imperative commit subject without a period, and add a body that explains what changed and why when the diff cannot.
tests, run by the registry9 passed · slowest 1.3 ms
- The advice links to cbea.ms, wellactually.dev
✓fires1.3 ms
points at the principle when the user asks for a commit
promptfired: "commit"
commit these changes✓quiet1.2 ms
stays quiet on the prompt What are the last three commits about?
promptstayed quiet
What are the last three commits about?✓quiet1.1 ms
stays quiet on the prompt Amend the last change
promptstayed quiet
Amend the last change✓quiet1.1 ms
stays quiet on the prompt run the pre-commit hook
promptstayed quiet
run the pre-commit hook✓fires0.8 ms
fires in full on an upcoming git commit -m
commandfired: "git commit -m"
git commit -m 'Explain the change'✓fires0.8 ms
fires on git commit -m after git add
commandfired: "git commit -m"
git add lib && git commit -m "Add passkey login"✓quiet0.8 ms
stays quiet on the command git log --oneline
commandstayed quiet
git log --oneline✓quiet0.8 ms
stays quiet on the command git commit --amend
commandstayed quiet
git commit --amend✓quiet0.8 ms
stays quiet on the command printf '%s\n' 'git commit -m is the documented form'
commandstayed quiet
printf '%s\n' 'git commit -m is the documented form'detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { command, detect, prompt } from "@wellactually/sdk/v3/test";
test("points at the principle when the user asks for a commit", () => {
expect(detect(prompt("commit these changes"))).toEqual([{ match: "commit", depth: "pointer" }]);
});
test.each(["What are the last three commits about?", "Amend the last change", "run the pre-commit hook"])("stays quiet on the prompt %s", (text) => {
expect(detect(prompt(text))).toEqual([]);
});
test("fires in full on an upcoming git commit -m", () => {
expect(detect(command("git commit -m 'Explain the change'"))).toEqual([{ match: "git commit -m" }]);
});
test("fires on git commit -m after git add", () => {
expect(detect(command('git add lib && git commit -m "Add passkey login"'))).toEqual([{ match: "git commit -m" }]);
});
test.each(["git log --oneline", "git commit --amend", "printf '%s\\n' 'git commit -m is the documented form'"])("stays quiet on the command %s", (line) => {
expect(detect(command(line))).toEqual([]);
});