From v28 to v29

    info

    See changelog for the full list of changes.

    From v28 to v29 - 图2note

    Upgrading from an older version? You can see the upgrade guide from v27 to v28 .

    As announced in the Jest 28 blog post, Jest 29 has changed the default snapshot formatting to {escapeString: false, printBasicPrototype: false}.

    If you want to keep the old behavior, you can set the snapshotFormat property to:

    jest-environment-jsdom has upgraded jsdom from v19 to v20. Note that if you use jest-environment-jsdom, the minimum TypeScript version is set to 4.5.

    Notably, jsdom@20 includes support for , which means packages like uuid and nanoid, which doesn’t work properly in Jest@28, can work without extra polyfills.

    Exports of Mocked* utility types from jest-mock package have changed. MaybeMockedDeep and now are exported as Mocked and MockedShallow respectively; only deep mocked variants of MockedClass, MockedFunction and MockedObject are exposed.

    info

    The TypeScript examples from this page will only work as documented if you import jest from '@jest/globals':

    jest.mocked()

    The jest.mocked() helper method now wraps types of deep members of passed object by default. If you have used the method with true as the second argument, remove it to avoid type errors: