jest-when
jest-when copied to clipboard
Jest support for mock argument-matched return values.
## Description Given the following code: ```typescript import { jest } from "@jest/globals"; import type { SpyInstance } from "jest-mock"; import type { ExecSyncOptions } from "node:child_process"; import { isInGitRepository...
Take a look at this code: ``` import { when } from 'jest-when'; class MyName { reGetName( name: string ) { return name; } getName( name: string ) { return...
Bumps [async](https://github.com/caolan/async) from 2.6.2 to 2.6.4. Changelog Sourced from async's changelog. v2.6.4 Fix potential prototype pollution exploit (#1828) v2.6.3 Updated lodash to squelch a security warning (#1675) Commits c6bdaca Version...
(node:16003) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1) at handledRejection In my test, I mock rejected value without `calledWith`, then I get the errors. ```javascript when(mockFn) .mockRejectedValue({}) ```...
I use `jest-when` quite a lot, and find it incredibly useful. However, I've struggled to get it to work when the `calledWith` parameter is itself a mock, like in the...
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. Commits See full diff in compare view [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter...
...and also added a flag `when.expectCallShouldAssert` to opt into disabling the existing behavior of `expectCalledWith`. Not sure this is 100% in line with how you'd want to go about this,...
That would expect a `Partial` of each of the arguments and apply `expect.objectContaining` matcher internally to each of the passed arguments. **How it is useful** Imagine method A receiving an...
I have a function where the first argument is an identifier and the second argument is an options object. Usually I don't care about the options object, so I frequently...
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1. Commits 2449650 Update mocha 560b2d8 Don't use regex to trim whitespace b1bdb92 Remove linting package zoo c20dc7e Cache 308 See full diff in compare...