new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

explore / Backend & APIs / mozg / Bun

Bun · Test runner

Answer questions about the Bun test runner: writing tests, the expect matchers, mocking, snapshots, coverage, and how it differs from Jest where the docs say so.

258 notes · updated 2026-08-09 · trained 88%

use this brain
# sign in to get a token
$ claude mcp add --transport http mozg \
https://mozg.sh/mcp --header "Authorization: Bearer …"
> use mozg/bun-test — …
Sign in — get this command with your token in it

New here? Sign in and this exact command appears with your token already inside — copy, paste into your terminal, done.

Or just add it

Sign in and add it, and every agent you have connected can read it — nothing to download, and it stays current as the author updates it.

Sign in to add it

Ask it things like

answers 26/30 on its latest exam
How do I write a basic test with the test() function in bun:test?Core Test Writing
How do I force a test to run sequentially instead of in parallel?Concurrency & Serial
How do I enable coverage reporting in Bun?Coverage
What basic matchers are available in Bun's expect?Expect Matchers
What is the difference between beforeAll and beforeEach?Lifecycle & Setup
How do I create a mock function in Bun?Mocking
How do I mock an entire module in Bun?Mocking
How do I write a snapshot test?Snapshots

What it can answer

30 coverage checks
88%
Answers 26 of the exam's 30 questions
Mocking5 / 5
Core Test Writing4 / 5
Lifecycle & Setup4 / 4
Snapshots4 / 4
Concurrency & Serial3 / 3
Test Organization3 / 4
Expect Matchers2 / 4
Coverage1 / 1
exam badge — share this score →

Attacks survived

re-run weekly · 2026-08-11
gate-battery12/12 known hostile payloads caught by the ingest gate
injection-corpusevery active note scanned — no steering language
secret-corpusevery active note scanned — no keys or credentials

heuristic scans against known attack classes — measured and dated, not a promise of unpoisonability

Inside

  • Default test timeout is 5 seconds · test/configuration
  • Mark tests as todo with test.todo · test/configuration
  • Group tests with describe blocks · test/configuration
  • Per-test timeout in milliseconds · test/configuration
  • Run test multiple times with test.repeats option · test/configuration
  • Skip tests with test.skip · test/configuration
  • Import test utilities from bun:test · test/configuration
  • Basic test structure · test/configuration
  • Async tests with async/await · test/lifecycle
  • Async tests with done callback · test/lifecycle
  • Timeout behavior kills child processes · test/lifecycle
  • Retry flaky tests with test.retry option · test/configuration
  • Cannot use both retry and repeats on same test · test/configuration
  • Run todo tests with --todo flag · test/configuration

Licence

CC BY-NC-SA 4.0

Use it, copy it, build on it, with credit. Selling it is not allowed.