diff --git a/packages/enzyme-utilities/src/test/index.test.tsx b/packages/enzyme-utilities/src/test/index.test.tsx index dcc0b7f199..9c7d983168 100644 --- a/packages/enzyme-utilities/src/test/index.test.tsx +++ b/packages/enzyme-utilities/src/test/index.test.tsx @@ -9,7 +9,7 @@ import {trigger, findById} from '..'; function noop() {} jest.mock('react-dom/test-utils', () => { - const actualTestUtilities = require.requireActual('react-dom/test-utils'); + const actualTestUtilities = jest.requireActual('react-dom/test-utils'); return { ...actualTestUtilities, @@ -17,7 +17,7 @@ jest.mock('react-dom/test-utils', () => { }; }); -const {act} = require.requireMock('react-dom/test-utils') as {act: jest.Mock}; +const {act} = jest.requireMock('react-dom/test-utils') as {act: jest.Mock}; describe('enzyme-utilities', () => { beforeEach(() => { diff --git a/packages/koa-performance/src/test/middleware.test.ts b/packages/koa-performance/src/test/middleware.test.ts index 0615a1b090..c666b9e428 100644 --- a/packages/koa-performance/src/test/middleware.test.ts +++ b/packages/koa-performance/src/test/middleware.test.ts @@ -31,7 +31,7 @@ const config = { logger: {log: jest.fn()}, }; -const StatsDClient = require.requireMock('@shopify/statsd').StatsDClient; +const StatsDClient = jest.requireMock('@shopify/statsd').StatsDClient; describe('client metrics middleware', () => { beforeEach(() => { diff --git a/packages/koa-shopify-graphql-proxy/src/test/proxy.test.ts b/packages/koa-shopify-graphql-proxy/src/test/proxy.test.ts index ce27268fdb..daaec99aef 100644 --- a/packages/koa-shopify-graphql-proxy/src/test/proxy.test.ts +++ b/packages/koa-shopify-graphql-proxy/src/test/proxy.test.ts @@ -10,7 +10,7 @@ jest.mock('koa-better-http-proxy', () => { return jest.fn(() => jest.fn()); }); -const proxyFactory = require.requireMock('koa-better-http-proxy'); +const proxyFactory = jest.requireMock('koa-better-http-proxy'); describe('koa-shopify-graphql-proxy', () => { beforeEach(() => { diff --git a/packages/react-bugsnag/src/test/client.test.ts b/packages/react-bugsnag/src/test/client.test.ts index fdf4542f76..2d9846b341 100644 --- a/packages/react-bugsnag/src/test/client.test.ts +++ b/packages/react-bugsnag/src/test/client.test.ts @@ -6,7 +6,7 @@ jest.mock('@bugsnag/js', () => ({ createClient: jest.fn(), })); -const Bugsnag = require.requireMock('@bugsnag/js'); +const Bugsnag = jest.requireMock('@bugsnag/js'); describe('createBugsnagClient()', () => { beforeEach(() => { diff --git a/packages/react-cookie/src/tests/CookieUniversalProvider.test.tsx b/packages/react-cookie/src/tests/CookieUniversalProvider.test.tsx index b591edeceb..80b2b510ef 100644 --- a/packages/react-cookie/src/tests/CookieUniversalProvider.test.tsx +++ b/packages/react-cookie/src/tests/CookieUniversalProvider.test.tsx @@ -10,7 +10,7 @@ import {CookieUniversalProvider} from '../CookieUniversalProvider'; import {CookieContext} from '../context'; import {BrowserCookieManager} from '../BrowserCookieManager'; -const {hasDocumentCookie} = require.requireMock('../utilities'); +const {hasDocumentCookie} = jest.requireMock('../utilities'); jest.mock('../utilities', () => ({ hasDocumentCookie: jest.fn(), diff --git a/packages/react-cookie/src/tests/hooks.test.tsx b/packages/react-cookie/src/tests/hooks.test.tsx index 3f6485047f..5b09d805fc 100644 --- a/packages/react-cookie/src/tests/hooks.test.tsx +++ b/packages/react-cookie/src/tests/hooks.test.tsx @@ -7,7 +7,7 @@ import {useCookie} from '../hooks'; import {clearCookies} from './utilities'; -const {hasDocumentCookie} = require.requireMock('../utilities'); +const {hasDocumentCookie} = jest.requireMock('../utilities'); jest.mock('../utilities', () => ({ hasDocumentCookie: jest.fn(), diff --git a/packages/react-graphql-universal-provider/src/test/GraphQLUniversalProvider.test.tsx b/packages/react-graphql-universal-provider/src/test/GraphQLUniversalProvider.test.tsx index 0d8bc3ebce..d313c96aaa 100644 --- a/packages/react-graphql-universal-provider/src/test/GraphQLUniversalProvider.test.tsx +++ b/packages/react-graphql-universal-provider/src/test/GraphQLUniversalProvider.test.tsx @@ -10,29 +10,29 @@ import {NetworkContext, NetworkManager} from '@shopify/react-network'; import {GraphQLUniversalProvider} from '../GraphQLUniversalProvider'; jest.mock('apollo-client', () => { - const ApolloClient = require.requireActual('apollo-client').ApolloClient; + const ApolloClient = jest.requireActual('apollo-client').ApolloClient; const mockApolloClient = jest.fn(options => new ApolloClient(options)); return { - ...require.requireActual('apollo-client'), + ...jest.requireActual('apollo-client'), default: mockApolloClient, ApolloClient: mockApolloClient, }; }); jest.mock('../utilities', () => ({ - ...require.requireActual('../utilities'), + ...jest.requireActual('../utilities'), isServer: jest.fn(), })); -const {isServer} = require.requireMock('../utilities'); +const {isServer} = jest.requireMock('../utilities'); jest.mock('../request-id-link', () => ({ - ...require.requireActual('../request-id-link'), + ...jest.requireActual('../request-id-link'), createRequestIdLink: jest.fn(), })); -const {createRequestIdLink} = require.requireMock('../request-id-link'); +const {createRequestIdLink} = jest.requireMock('../request-id-link'); -const ApolloClient = require.requireMock('apollo-client').default; +const ApolloClient = jest.requireMock('apollo-client').default; describe('', () => { beforeEach(() => { @@ -51,7 +51,7 @@ describe('', () => { ); expect(graphQL).toContainReactComponent(ApolloProvider, { - client: expect.any(require.requireActual('apollo-client').ApolloClient), + client: expect.any(jest.requireActual('apollo-client').ApolloClient), }); }); diff --git a/packages/react-i18n/src/test/i18n.test.ts b/packages/react-i18n/src/test/i18n.test.ts index 3ee99da3fa..8d45b31c9e 100644 --- a/packages/react-i18n/src/test/i18n.test.ts +++ b/packages/react-i18n/src/test/i18n.test.ts @@ -8,7 +8,7 @@ import {DateStyle, Weekday} from '../constants'; import {MissingTranslationError} from '../errors'; jest.mock('../utilities', () => ({ - ...require.requireActual('../utilities'), + ...jest.requireActual('../utilities'), translate: jest.fn(), getTranslationTree: jest.fn(), getCurrencySymbol: jest.fn(), diff --git a/packages/react-i18n/src/test/utilities.test.tsx b/packages/react-i18n/src/test/utilities.test.tsx index 8e22f2ddf5..67af09fc86 100644 --- a/packages/react-i18n/src/test/utilities.test.tsx +++ b/packages/react-i18n/src/test/utilities.test.tsx @@ -9,7 +9,7 @@ import { memoizedPluralRules, } from '../utilities'; -const {pseudotranslate} = require.requireMock('@shopify/i18n') as { +const {pseudotranslate} = jest.requireMock('@shopify/i18n') as { pseudotranslate: jest.Mock; }; diff --git a/packages/react-import-remote/src/test/ImportRemote.test.tsx b/packages/react-import-remote/src/test/ImportRemote.test.tsx index 6fffc4cc77..b538490103 100644 --- a/packages/react-import-remote/src/test/ImportRemote.test.tsx +++ b/packages/react-import-remote/src/test/ImportRemote.test.tsx @@ -18,7 +18,7 @@ jest.mock('@shopify/react-html', () => ({ })); jest.mock('@shopify/react-intersection-observer', () => ({ - ...require.requireActual('@shopify/react-intersection-observer'), + ...jest.requireActual('@shopify/react-intersection-observer'), IntersectionObserver() { return null; }, @@ -26,7 +26,7 @@ jest.mock('@shopify/react-intersection-observer', () => ({ jest.mock('../load', () => jest.fn()); -const load: jest.Mock = require.requireMock('../load'); +const load: jest.Mock = jest.requireMock('../load'); describe('', () => { beforeEach(() => { diff --git a/packages/react-intersection-observer/src/test/IntersectionObserver.test.tsx b/packages/react-intersection-observer/src/test/IntersectionObserver.test.tsx index cf84d6459e..3ef3435e7a 100644 --- a/packages/react-intersection-observer/src/test/IntersectionObserver.test.tsx +++ b/packages/react-intersection-observer/src/test/IntersectionObserver.test.tsx @@ -9,7 +9,7 @@ jest.mock('../utilities', () => ({ isSupported: jest.fn(), })); -const {isSupported} = require.requireMock('../utilities') as { +const {isSupported} = jest.requireMock('../utilities') as { isSupported: jest.Mock; }; diff --git a/packages/react-router/src/components/Link/tests/Link.test.tsx b/packages/react-router/src/components/Link/tests/Link.test.tsx index 93f7ef7e74..651fab8839 100644 --- a/packages/react-router/src/components/Link/tests/Link.test.tsx +++ b/packages/react-router/src/components/Link/tests/Link.test.tsx @@ -5,7 +5,7 @@ import {mount} from '@shopify/react-testing'; import Link from '../Link'; jest.mock('react-router-dom', () => ({ - ...require.requireActual('react-router-dom'), + ...jest.requireActual('react-router-dom'), Link: function Link() { return null; }, diff --git a/packages/react-router/src/components/Router/test/Router.test.tsx b/packages/react-router/src/components/Router/test/Router.test.tsx index 629c78de56..c90f5de92b 100644 --- a/packages/react-router/src/components/Router/test/Router.test.tsx +++ b/packages/react-router/src/components/Router/test/Router.test.tsx @@ -8,7 +8,7 @@ jest.mock('../utilities', () => ({ isClient: jest.fn(), })); -const {isClient} = require.requireMock('../utilities') as { +const {isClient} = jest.requireMock('../utilities') as { isClient: jest.Mock; }; diff --git a/packages/sewing-kit-koa/src/tests/manifests-locales.test.ts b/packages/sewing-kit-koa/src/tests/manifests-locales.test.ts index 3665ebbf0e..97bc31e2b5 100644 --- a/packages/sewing-kit-koa/src/tests/manifests-locales.test.ts +++ b/packages/sewing-kit-koa/src/tests/manifests-locales.test.ts @@ -11,13 +11,13 @@ import { } from './test-utilities'; jest.mock('fs-extra', () => ({ - ...require.requireActual('fs-extra'), + ...jest.requireActual('fs-extra'), pathExists: jest.fn(() => Promise.resolve(false)), readFile: jest.fn(() => '[]'), readJson: jest.fn(() => []), })); -const {pathExists, readFile, readJson} = require.requireMock('fs-extra'); +const {pathExists, readFile, readJson} = jest.requireMock('fs-extra'); describe('Manifests locales', () => { beforeEach(() => { diff --git a/packages/sewing-kit-koa/src/tests/manifests-read.test.ts b/packages/sewing-kit-koa/src/tests/manifests-read.test.ts index 8f54b41d4d..868db19910 100644 --- a/packages/sewing-kit-koa/src/tests/manifests-read.test.ts +++ b/packages/sewing-kit-koa/src/tests/manifests-read.test.ts @@ -15,13 +15,13 @@ import { } from './test-utilities'; jest.mock('fs-extra', () => ({ - ...require.requireActual('fs-extra'), + ...jest.requireActual('fs-extra'), pathExists: jest.fn(() => Promise.resolve(false)), readFile: jest.fn(() => '[]'), readJson: jest.fn(() => []), })); -const {pathExists, readFile, readJson} = require.requireMock('fs-extra'); +const {pathExists, readFile, readJson} = jest.requireMock('fs-extra'); describe('Manifests read', () => { beforeEach(() => { diff --git a/packages/sewing-kit-koa/src/tests/manifests-user-agent.test.ts b/packages/sewing-kit-koa/src/tests/manifests-user-agent.test.ts index 8d4ca354fe..b380823d5e 100644 --- a/packages/sewing-kit-koa/src/tests/manifests-user-agent.test.ts +++ b/packages/sewing-kit-koa/src/tests/manifests-user-agent.test.ts @@ -11,13 +11,13 @@ import { } from './test-utilities'; jest.mock('fs-extra', () => ({ - ...require.requireActual('fs-extra'), + ...jest.requireActual('fs-extra'), pathExists: jest.fn(() => Promise.resolve(false)), readFile: jest.fn(() => '[]'), readJson: jest.fn(() => []), })); -const {pathExists, readFile, readJson} = require.requireMock('fs-extra'); +const {pathExists, readFile, readJson} = jest.requireMock('fs-extra'); describe('Manifests user agents', () => { beforeEach(() => {