# X_TEST_THROW_NOT_THROWN

## Means

`expect(fn).toThrow(…)` is given a callback that **returns** an error instead of throwing one

## Typical cause

bun's synchronous `toThrow` **passes** on a returned `Error` — `expect(() => new Boom('x')).toThrow(Boom)` is green, in the bare, class and string-matcher forms alike — so the assertion cannot fail. This repo exports 196 functions that return an error beside a matching set that throws, and `expect(() => sendFailed(…))` is the shape. A returned non-error is reported correctly by bun, and `rejects.toThrow` is unaffected. Only certain shapes are reported: an error construction, or a call to a function this repo declares as returning one

## Fix

wrap it in a throw at the site the finding names — `expect(() => { throw <expr>; }).toThrow(…)` — or assert the value directly with `expect(<expr>).toBeInstanceOf(…)`

[CLI and verify](/error-codes#cli-and-verify)
