Agent skill · software engineering · secondsky

bun-test-lifecycle

Use for test lifecycle hooks: beforeAll, afterAll, beforeEach, afterEach, fixtures, preload.

Why this skill is useful

Provides specific lifecycle hook patterns and async setup scripts for Bun testing that are not widely known.

What it needs

Requires bun installed locally. About 3k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Bun Test Lifecycle Bun supports Jest-compatible lifecycle hooks for test setup and teardown. Lifecycle Hooks Hook Execution Order Nested Describe Hooks Async Hooks Timeout for Hooks Preload Scripts Use --preload for global setup across all test files: setup.ts Configure in bunfig.toml Common Patterns Database Setup Server Setup Mock Setup Environment Variables Shared Fixtures Hook Errors If a hook throws, all tests in that describe block fail: Common Errors Error Cause Fix ------- ------- ----- beforeAll timeout Slow async setup Increase timeout Hook not called Wrong scope Check hook placement Cleanup not run afterAll skipped Ensure no throws in tests State leak Missing cleanup Add proper afterEach When to Load References Load references/preload-scripts.md when: Complex global setup Multiple preload files Load references/fixtures.md when: Reusable test fixtures Factory patterns

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/bun-test-lifecycle

View the source on GitHub

Browse the @skills marketplace