Closed jackhkmatthews closed 1 year ago
Use jest.requireActual to avoid using a CommonJS require statement .
jest.requireActual
require
In my TS project, ESLint was shouting at me when using require: https://typescript-eslint.io/rules/no-var-requires
Using requireActual resolved this:
requireActual
jest.mock("next/router", () => jest.requireActual<MemoryRouter>("next-router-mock"));
Thank you! Worked great on an example app.
Use
jest.requireActual
to avoid using a CommonJSrequire
statement .In my TS project, ESLint was shouting at me when using
require
: https://typescript-eslint.io/rules/no-var-requiresUsing
requireActual
resolved this: