agentleFS
theseus-runtheseus-run/theseus/.agents/skills/bun-test/SKILL.md

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

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
  1. Very specific:

    Use this skill for tests run by bun test.

    line 8
  2. Distinctive:

    Use only the APIs needed by the test.

    line 23
  3. Distinctive:

    Test behavior through public exports where practical.

    line 27
  4. Distinctive:

    Use narrow tests for boundary behavior: schema failures, typed failures, serialization, stream completion, and runtime lifecycle.

    line 28
  5. Very specific:

    Use mock for small injected functions.

    line 36
  6. Very specific:

    Use spyOn when observing object methods.

    line 37
  7. Distinctive:

    Prefer dependency injection or test layers over module mocking for Effect services.

    line 39
  8. Very specific:

    Do not leave test.only or focus filters in committed tests.

    line 51
  9. Distinctive:

    Do not use sleeps to paper over async lifecycle bugs.

    line 52
  10. Distinctive:

    Do not assert implementation details when public behavior is available.

    line 53
  11. Distinctive:

    Do not update snapshots unless the output change is intentional and reviewed.

    line 54

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Bun Test

Use this skill for tests run by bun test.

Repo Facts

  • Root test command: bun run test -> bun test.
  • packages/theseus-tools has bun test src/.
  • packages/jsx-md and packages/jsx-md-beautiful-mermaid use package-local bun 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 _tag and 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 mock for small injected functions.
  • Use spyOn when observing object methods.
  • Restore mocks in afterEach when 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.only or 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.