Closed
Description
Version
27.4.3
Steps to reproduce
Try to use jest.mocked
. E. g.:
// foo.ts
export const foo = { };
// foo.spec.ts
import {foo} from './foo';
jest.mock('./foo');
const mockedFoo = jest.mocked(foo);
Expected behavior
jest.mocked
is defined and working.
Actual behavior
Error: TypeError: jest.mocked is not a function
.
Also documentation is missing on https://jestjs.io/docs/jest-object, but present in source code: https://github.com/facebook/jest/blob/main/docs/JestObjectAPI.md#jestmockedtitem-t-deep--false
Additional context
jest.mocked
was added in #12089, but seems it was not added to jest
object, and only to jest-mock
package.
Tagging author of original PR @k-rajat19
Environment
System:
OS: macOS 11.6.1
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.2.0 - /usr/local/bin/npm
npmPackages:
jest: ^27.4.3 => 27.4.3