Apia saysTests prove code works: unit (Jest/Vitest), component, and end-to-end (Playwright).
Automated tests catch regressions before users do. Unit tests (Vitest/Jest) check small functions in isolation; integration tests cover modules together; end-to-end (Playwright/Cypress) drive a real browser through user flows. The shape: describe/it with expect(...).toBe(...). Write the test that would have caught the bug.
Power-ups you unlock
Unit (Vitest/Jest) → small functions
E2E (Playwright) → real browser flows
expect(value).toBe(expected) assertions
Tests catch regressions automatically
Legacy Larry attacks — common mistakes
Testing implementation details, not behavior
Only happy-path tests (skip edge cases)
No tests at all on critical logic
Boss battleWrite a tiny unit test (in your head) for an add function, including an edge case.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>import { test, expect } from 'vitest';
import { add } from './math.js';
test('adds numbers', () => {
expect(add(2, 3)).toBe(5);
expect(add(-1, 1)).toBe(0); // edge case
});</pre></body></html>