Skip to main content
Create mocks with the mock function from bun:test.
test.ts

The mock function can accept arguments.
test.ts

The result of mock() is a new function decorated with extra properties.
test.ts

Use these properties to write expect assertions about how the mock was used: how many times it was called, with which arguments, and what it returned.
test.ts

See Mocks.