- Having a better overview of mocks
- Have a more readable test file
- Creating the mock using
jest.mocked
on top level outside ofdescribe
- using a different way to organize the mocks (like
jest-mock-grouped
andjest.mocked.grouped
) - don't want to have a strict grouping of mocks
code:
import { something } from 'some-path';
jest.mock('some-path');
const somethingMock = jest.mocked(something);`,
code:
const somethingMock = jest.mocked(something);
const somethingElse = fromSomeWhereElse();
const somethingMock = jest.mocked(something);`,
import { something } from 'some-path';
jest.mock('some-other-path');
const somethingMock = jest.mocked(something);
This ESLint rule is pretty simple. It currently has no configuration.
'jest-mock-directly-above-jest-mocked': 'error',