sindresorhus/eslint-plugin-unicorn

consistent-function-scoping should ignore jest mocks

Fechada

#805 aberto em 4 de ago. de 2020

 (1 comentário) (0 reação) (0 responsável)JavaScript (468 forks)user submission
enhancementhelp wanted

Métricas do repositório

Stars
 (5.022 estrelas)
Métricas de merge de PR
 (Mesclagem média 4h 30m) (26 fundiu PRs em 30d)

Description

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");

Guia do colaborador