Skip to content

Repository files navigation

node-kata

TDD kata practice harness. Built for Incubyte interview prep but reusable for any kata work.

Stack

  • Node.js + TypeScript (strict, ESM)
  • Jest + ts-jest (ESM preset)
  • ESLint (flat config, type-aware) + Prettier
  • Stryker for mutation testing

Workflow

One kata per branch. main stays clean — just the harness.

git checkout -b kata/string-calculator
# write tests + code, commit in tiny steps
# when done:
git checkout main
git branch -D kata/string-calculator   # or keep it for reference

This way every kata starts from a known-good clean slate, and your git log for each branch tells the TDD story for that kata.

Commands

npm test                       # run all tests
npm run test:watch             # TDD red-green-refactor loop
npm run test:coverage          # coverage report
npm run lint                   # ESLint
npm run lint:fix               # ESLint with autofix
npm run format                 # Prettier write
npm run format:check           # Prettier check
npm run typecheck              # tsc --noEmit
npm run mutation               # Stryker mutation testing

Conventions

  • Source files: src/<kata-name>/<name>.ts
  • Test files: src/<kata-name>/<name>.test.ts colocated
  • Commit messages: Conventional Commits (test:, feat:, refactor:, chore:)
  • Commit at every green and every refactor

Mutation testing

Stryker mutates your source code and re-runs your tests. A killed mutant means your tests caught the change. A survived mutant means your tests are blind to that behaviour.

npm mutation

Open reports/mutation/mutation.html to see the report.

Target a mutation score above 80% on serious kata work. Anything lower means tests aren't pinning behaviour down.

TDD rules (Kent Beck)

  1. You may not write production code until you have written a failing unit test
  2. You may not write more of a unit test than is sufficient to fail
  3. You may not write more production code than is sufficient to pass the failing test

About

TDD kata practice

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages