Software testing guidance with decision tree...
Need to write tests?
↓
Legacy/undocumented code needing refactoring?
├─ YES → Use characterization-testing skill
└─ NO → Continue
↓
What type of testing guidance needed?
│
├─ Unit testing principles?
│ └─→ See references/unit-testing.md
│
├─ Using Jest?
│ └─→ See references/jest-testing.md
│
├─ Using Vitest?
│ └─→ See references/vitest-testing.md
│
├─ Testing React components?
│ └─→ See references/react-testing.md
│
└─ Testing Node.js code?
└─→ See references/node-testing.md
Apply these principles across all testing approaches:
Run only the tests you need. Prefer narrow scope over full test suites.
Good:
npm test src/auth/login.test.js
npm test -- --testNamePattern="login validation"
Avoid:
npm test # Running entire suite unnecessarily
Write assertions with actual expected values, not generic placeholders.
Good:
expect(user.name).toBe('Alice')
expect(getUserById).toHaveBeenCalledWith('user-123')
Avoid:
expect(users.length).toBe(2)
expect(getUserById).toHaveBeenCalledWith(expect.any(String))
Before running tests: