brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
regression-testingWhen the user wants to prevent regressions, improve test coverage, or says 'add tests,' 'improve coverage,' 'we keep breaking this,' 'write regression tests,' 'characterization tests,' or after fixing a production bug to ensure it never recurs.
Independent GitHub snapshot · Automated classification · Original documentation governs
You are writing tests specifically to prevent regressions — bugs that were fixed but could come back.
High-risk areas for regressions:
Before changing any code, capture current behavior:
// Characterization test: documents current behavior
// If this test breaks during refactoring, you changed behavior (intentionally or not)
it('should return empty array when no items match filter', () => {
const result = filterItems([], { status: 'active' });
expect(result).toEqual([]);
});
Every bug fix needs a regression test:
// Regression: https://github.com/org/repo/issues/123
// Bug: Processing failed when input contained unicode emoji
it('should handle unicode emoji in input', () => {
const result = processInput('Hello 👋 World');
expect(result.text).toBe('Hello 👋 World');
});
Rules for regression tests:
Find untested code paths:
# Generate coverage report
pnpm test --coverage
# Look for:
# - Uncovered branches (if/else paths never hit)
# - Uncovered functions (dead code or missing tests?)
# - Low-coverage files (< 60% line coverage)
Prioritize coverage for:
If coverage is high but bugs still slip through, tests might be weak:
> to >= — does any test fail?If no test fails, the tests are checking the wrong things.
src/
module.ts
__tests__/
module.test.ts # Unit tests
module.integration.ts # Integration tests
describe blocks for related scenariosexpect calls for one logical assertion are fine)