Skip to main content
@usenarrator/plugin-testing The testing plugin reads describe, test, it, lifecycle hooks and expect(...) matchers. It works for Bun’s test runner, Jest and Vitest, since they share these names. Tests read as a list of named checks, which makes them a useful summary of what code is supposed to do.

Examples

Groups, hooks and checks
English
Negated and argument-less matchers
English

What it covers

  • Blocks: describe, test, it, beforeAll, beforeEach, afterAll, afterEach.
  • Matchers: toBe, toEqual, toStrictEqual, toMatchObject, toBeDefined, toBeUndefined, toBeNull, toBeTruthy, toBeFalsy, toHaveLength, toContain, toThrow, the four numeric comparisons, toBeCloseTo, toHaveProperty and toBeInstanceOf. Any .not flips the check.
  • Other matchers read as “check that X matches Y” using the matcher’s name.
The phrasebook has phrases for toHaveBeenCalled, toHaveBeenCalledTimes and toHaveBeenCalledWith, but these matchers are currently misread as a function whose name starts with “to”. Avoid relying on them until that is fixed.

Translating

The English phrasebook is exported as testingEn and typed as TestingPhrases.