Agent skill · software engineering · secondsky

bun-test-mocking

Use for mock functions in Bun tests, spyOn, mock.module, implementations, and test doubles.

Why this skill is useful

Provides specific Bun test mocking patterns and implementations that are not widely known or documented.

What it needs

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

What this skill does

Bun Test Mocking Bun provides Jest-compatible mocking with mock(), spyOn(), and module mocking. Mock Functions jest.fn() Compatibility Mock Return Values Mock Implementations Spy on Methods Mock Modules Mock Node Modules Mock with Factory Mock Assertions Mock Properties Common Patterns Mock Fetch Mock Console Mock Class Methods Common Errors Error Cause Fix ------- ------- ----- Cannot spy on undefined Property doesn't exist Check property name Not a function Trying to mock non-function Use correct mock approach Already mocked Double mocking Use mockRestore first Module not found Wrong module path Check path in mock.module When to Load References Load references/mock-api.md when: Complete mock/spy API reference Advanced mocking patterns Load references/module-mocking.md when: Complex module mocking Hoisting behavior details

How to use it

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

@skills secondsky/bun-test-mocking

View the source on GitHub

Browse the @skills marketplace