Test-Driven Development following Kent Beck's TDD and Tidy First principles. Use when implementing features with test-first approach, following Red-Green-Refactor cycle, or separating structural changes from behavioral changes in commits.
Follow the TDD cycle: Red -> Green -> Refactor
// 1. Write failing test
test('shouldSumTwoPositiveNumbers', () => {
expect(sum(2, 3)).toBe(5);
});
// 2. Write minimum code to pass
function sum(a: number, b: number): number {
return a + b;
}
// 3. Refactor if needed (tests still pass)
Separate commits into two types:
Only commit when: