source: frontend/node_modules/eslint-plugin-jest/docs/rules/no-deprecated-functions.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.8 KB
Line 
1# Disallow use of deprecated functions (`no-deprecated-functions`)
2
3Over the years Jest has accrued some debt in the form of functions that have
4either been renamed for clarity, or replaced with more powerful APIs.
5
6While typically these deprecated functions are kept in the codebase for a number
7of majors, eventually they are removed completely.
8
9This rule requires knowing which version of Jest you're using - see
10[this section of the readme](../../README.md#jest-version-setting) for details
11on how that is obtained automatically and how you can explicitly provide a
12version if needed.
13
14## Rule details
15
16This rule warns about calls to deprecated functions, and provides details on
17what to replace them with, based on the version of Jest that is installed.
18
19This rule can also autofix a number of these deprecations for you.
20
21### `jest.resetModuleRegistry`
22
23This function was renamed to `resetModules` in Jest 15, and is scheduled for
24removal in Jest 27.
25
26### `jest.addMatchers`
27
28This function was replaced with `expect.extend` in Jest 17, and is scheduled for
29removal in Jest 27.
30
31### `require.requireActual` & `require.requireMock`
32
33These functions were replaced in Jest 21 and removed in Jest 26.
34
35Originally, the `requireActual` & `requireMock` the `requireActual`&
36`requireMock` functions were placed onto the `require` function.
37
38These functions were later moved onto the `jest` object in order to be easier
39for type checkers to handle, and their use via `require` deprecated. Finally,
40the release of Jest 26 saw them removed from the `require` function all
41together.
42
43### `jest.runTimersToTime`
44
45This function was renamed to `advanceTimersByTime` in Jest 22, and is scheduled
46for removal in Jest 27.
47
48### `jest.genMockFromModule`
49
50This function was renamed to `createMockFromModule` in Jest 26, and is scheduled
51for removal in a future version of Jest.
Note: See TracBrowser for help on using the repository browser.