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 / Web & frontend / mozg / Vitest

Vitest · API reference

Answer questions about the Vitest API exactly as specified: describe, test, expect and the vi object with every method's signature, and every assertion matcher with its behaviour.

1,081 notes · updated 2026-08-14 · trained 86%

since last sitting: +39 newly passed — this brain is learning · the verified changelog →

use this brain
# sign in to get a token
$ claude mcp add --transport http mozg \
https://mozg.sh/mcp --header "Authorization: Bearer …"
> use mozg/vitest-api — …
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 39/43 on its latest exam
What hooks are available and when do beforeAll, beforeEach, afterAll, afterEach run?hooks
Can you describe.skip, describe.only, and describe.todo - what do each do?describe API
What is the difference between toEqual and toStrictEqual?expect matchers
What does toThrow matcher do and what is required?expect matchers
What is test.each and how do you pass data - array vs object syntax?test API
What does vi.fn() do and what signature does it have?vi object
What does vi.spyOn do and what is required for class methods?vi object
What is vi.mock and what is its hoisting behavior?vi object

What it can answer

43 coverage checks
86%
Answers 39 of the exam's 43 questionsIt answers 39 questions, 39 more than last time, out of an exam that grew by 43.Nothing it used to answer has stopped working.
vi object15 / 15
expect matchers8 / 9
async and timing4 / 4
expect utilities4 / 4
DOM matchers2 / 3
hooks2 / 2
test API2 / 3
advanced mocking1 / 1
describe API1 / 2
exam badge — share this score →

Attacks survived

re-run weekly · 2026-08-10
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

  • vi.isWhenChain - type guard for When chains · vi object/methods
  • vi.mock - default export caveat · vi object/methods
  • vi.when - times option · vi object/methods
  • toHaveBeenExhausted assertion · expect api
  • vi.mock - spy option · vi object/methods
  • vi.mock - module promise signature · vi object/methods
  • vi.when - per-argument spy behavior · vi object/methods
  • vi.when - available then* methods · vi object/methods
  • vi.when example with fallback and times · vi object/methods
  • vi.when basic example · vi object/methods
  • vi.mock - function signature · vi object/methods
  • vi.mock - hoisting behavior · vi object/methods
  • vi.mock spy example · vi object/methods
  • vi.mock - __mocks__ folder support · vi object/methods

Licence

CC BY-NC-SA 4.0

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