mcous

mcous/vitest-when

Stub behaviors of Vitest mock functions based on how they are called

TypeScript
50
8
MIT License

**Project summary** `vitest-when` adds a lightweight, declarative API for configuring stub behaviors on Vitest mock functions, letting you specify exact argument matches (via `calledWith`) and attach precise return, promise‑resolve, throw, or side‑effect handlers (`thenReturn`, `thenResolve`, `thenThrow`, `thenDo`, etc.) without scattering expectations across test phases. It’s aimed at developers who want clearer, harder‑to‑misconfigure mock setups—especially in TypeScript projects—where stub configuration lives entirely in the “arrange” stage and is fully type‑checked.

Total donated
Undistributed
Share with your subscribers:

Recipients

How the donated funds are distributed

Support the dependencies of mcous/vitest-when

Account's avatar
Stringify any JavaScript value.
Account's avatar
My base ESLint configuration.
Account's avatar
My base Prettier configuration.
Account's avatar
My base TypeScript configuration.
Account's avatar
TypeScript definitions for node
Account's avatar
Istanbul coverage provider for Vitest
Account's avatar
Jest's expect matchers as a Chai plugin
Account's avatar
Run commands concurrently
Account's avatar
Bundle your TypeScript library with no config, powered by esbuild
Account's avatar
TypeScript is a language for application scale JavaScript development
Account's avatar
Next generation testing framework powered by Vite

Support the repos that depend on mcous/vitest-when

Top contributors

mcous's profile
mcous
49 contributions
sirlancelot's profile
sirlancelot
2 contributions
tommie-lie's profile
tommie-lie
1 contributions

Recent events

Kivach works on the Obyte network, and therefore you can track all donations.

No events yet