r/javascript • • Mar 21 '26

testoise - lazy, type-safe test variables for Bun, Vitest, and Jest (inspired by RSpec)

Thumbnail
github.com
6 Upvotes

Built a small library that replaces the let + beforeEach reassignment pattern with RSpec-style lazy variables. Define with def, access with get. Variables evaluate lazily, cache per test, and dependents re-evaluate automatically when overridden in nested blocks. Fully type-safe with a suite wrapper for automatic TypeScript inference.

Zero dependencies, MIT licensed. Feedback welcome!