bun-test
Skill1 starsChanged 6 months agoMITView on GitHub
Use when creating, modifying, debugging, or running Bun tests with bun:test, including package-local test commands, async tests, mocks, spies, snapshots, and Effect.runPromise test boundaries.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- involvex/youtube-music-clitheir own version, first seen Oct 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- involvex/youtube-music-cli★ 477same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-self-checkSkill
- biome-grit-rulesSkill
- biome-toolingSkill
- bun-workspaceSkill
- cleanup-auditSkill
- code-reviewSkill
- dispatch-satelliteSkill
- docs-managementSkill
- docs-readingSkill
- effect-concurrency-lifecycleSkill
- effect-errors-schemaSkill
- effect-observability-timeSkill
- effect-services-layersSkill
- effect-testing-runtimeSkill
- effect-v4Skill
- jsx-md-authoringSkill
- monorepo-maintenanceSkill
- refactoring-disciplineSkill
- roadmap-managementSkill
- runtime-engineSkill
- server-runtimeSkill
- testing-patternsSkill
- theseus-designSkill
- tool-authoringSkill
- typescript-strictSkill
- ui-layout-disciplineSkill
- theseus-designSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use this skill for tests run by bun test.
- Distinctive: line 23
Use only the APIs needed by the test.
- Distinctive: line 27
Test behavior through public exports where practical.
- Distinctive: line 28
Use narrow tests for boundary behavior: schema failures, typed failures, serialization, stream completion, and runtime lifecycle.
- Very specific: line 36
Use mock for small injected functions.
- Very specific: line 37
Use spyOn when observing object methods.
- Distinctive: line 39
Prefer dependency injection or test layers over module mocking for Effect services.
- Very specific: line 51
Do not leave test.only or focus filters in committed tests.
- Distinctive: line 52
Do not use sleeps to paper over async lifecycle bugs.
- Distinctive: line 53
Do not assert implementation details when public behavior is available.
- Distinctive: line 54
Do not update snapshots unless the output change is intentional and reviewed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bun Test
Use this skill for tests run by bun test.
Repo Facts
- Root test command:
bun run test->bun test. packages/theseus-toolshasbun test src/.packages/jsx-mdandpackages/jsx-md-beautiful-mermaiduse package-localbun test.- Tests live beside source or under
src/__tests__/.
Imports
import { describe, expect, test, beforeEach, afterEach, mock, spyOn } from "bun:test";Use only the APIs needed by the test. Keep setup close to the tests unless it is reused across files.
Test Shape
- Test behavior through public exports where practical.
- Use narrow tests for boundary behavior: schema failures, typed failures, serialization, stream completion, and runtime lifecycle.
- For Effect code, run effects at the test boundary with
Effect.runPromise. - Assert typed failures by
_tagand fields, not by brittle stringified output. - For streams, assert both emitted values and completion behavior.
- For background fibers, assert interruption, shutdown, or result handoff.
Mocks And Spies
- Use
mockfor small injected functions. - Use
spyOnwhen observing object methods. - Restore mocks in
afterEachwhen they can leak state. - Prefer dependency injection or test layers over module mocking for Effect services.
Commands
- Whole repo:
bun run test. - Specific file:
bun test path/to/file.test.ts. - Package scope: run the package script if present.
- Name filter:
bun test -t "pattern". - Watch mode is for local iteration, not final verification.
Anti-Patterns
- Do not leave
test.onlyor focus filters in committed tests. - Do not use sleeps to paper over async lifecycle bugs.
- Do not assert implementation details when public behavior is available.
- Do not update snapshots unless the output change is intentional and reviewed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

