diff --git a/plugins/lighthouse/src/components/AuditList/index.test.tsx b/plugins/lighthouse/src/components/AuditList/index.test.tsx index 2813f554b8..94181f166d 100644 --- a/plugins/lighthouse/src/components/AuditList/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditList/index.test.tsx @@ -15,12 +15,13 @@ */ jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); const mocks = { replace: jest.fn(), push: jest.fn(), }; return { - ...jest.requireActual('react-router-dom'), + ...actual, useHistory: jest.fn(() => mocks), }; }); diff --git a/plugins/lighthouse/src/components/AuditView/index.test.tsx b/plugins/lighthouse/src/components/AuditView/index.test.tsx index 000780a1cb..9f218faf53 100644 --- a/plugins/lighthouse/src/components/AuditView/index.test.tsx +++ b/plugins/lighthouse/src/components/AuditView/index.test.tsx @@ -16,10 +16,13 @@ /* eslint-disable jest/no-disabled-tests */ -jest.mock('react-router-dom', () => ({ - ...jest.requireActual('react-router-dom'), - useParams: jest.fn(() => ({})), -})); +jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); + return { + ...actual, + useParams: jest.fn(() => ({})), + }; +}); import React from 'react'; import mockFetch from 'jest-fetch-mock'; diff --git a/plugins/lighthouse/src/components/CreateAudit/index.test.tsx b/plugins/lighthouse/src/components/CreateAudit/index.test.tsx index f15ee19ede..e36b00d489 100644 --- a/plugins/lighthouse/src/components/CreateAudit/index.test.tsx +++ b/plugins/lighthouse/src/components/CreateAudit/index.test.tsx @@ -15,12 +15,13 @@ */ jest.mock('react-router-dom', () => { + const actual = jest.requireActual('react-router-dom'); const mocks = { replace: jest.fn(), push: jest.fn(), }; return { - ...jest.requireActual('react-router-dom'), + ...actual, useHistory: jest.fn(() => mocks), }; });