Back to Sinon

spy.withArgs

docs/concepts/spies/api/with-args.md

22.1.0521 B
Original Source

spy.withArgs

Creates a spy or stub that only records calls when the received arguments match those passed to withArgs. This is useful to be more expressive in your assertions, where you can access the spy with the same call.

Uses deep comparison for objects and arrays. Use spy.withArgs(sinon.match.same(obj)) for strict comparison (see matchers).

<<< ../../../.vitepress/tests/docs/spies/api/with-args.test.js