Sentry's alexdotjs bans beforeEach in favor of explicit resource management with using
alexdotjs · x · 2026-10-29
Sentry co-founder David Cramer (alexdotjs) responds to Zeeg's critique of his testing style with a concrete pattern:
- Replace the let ctx = null + beforeEach/afterEach combo with TypeScript's using: using ctx = setup() handles creation and cleanup in one line
- Benefits: fewer lines, tests read top-to-bottom without implicit global state, more intentional and modular helpers
- He has also banned beforeAll(), with a couple of exceptions
Zeeg counters that per-test setup is excessive duplication and argues boilerplate is especially harmful with AI coding agents, which keep duplicating semi-broken setup code across a codebase. The core dispute: explicit vs implicit test context management.
More from coding & agent
- Stack Overflow launches Stack Internal, a knowledge engine for teams and AI agents — pchandrasekar · 2026-10-29
- What was the turning point for Postgres? PlanetScale traces the database's path to AI-era default — rseroter · 2026-10-29
- Locals runs multi-agent LLMs on MacBook up to 3x faster; LFM3 hits 620 tok/s on M2 — JosephJacks_ · 2026-10-29
- Stack Overflow launches Scopes: permission-governed knowledge spaces for AI agents — pchandrasekar · 2026-10-29
- Running NVIDIA's Open-H3-Regenerate-2K on a 4090: sharper but rewrites the actor's performance — friedlc · 2026-10-29
- mcp-coatcheck: A Proxy That Runs Slow MCP Tool Calls in the Background to Avoid Timeouts — Awacer · 2026-10-29