sindresorhus/eslint-plugin-unicorn

consistent-function-scoping should ignore jest mocks

Chiusa

#805 aperta il 4 ago 2020

 (1 commento) (0 reazioni) (0 assegnatari)JavaScript (468 fork)user submission
enhancementhelp wanted

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 4h 30m) (26 PR mergiate in 30 g)

Descrizione

Using jest.mock() does not work properly with consistent-function-scoping as it's not allowed to reference any out of scope variables as mocked function.

ReferenceError: /__tests__/search.spec.tsx: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.

jest.mock("next/dynamic", () => () => "dynamic-drawer");

Guida contributor