diff --git a/packages/replay/jest.setup.ts b/packages/replay/jest.setup.ts index b44298a751e1..2c0ec715b7f6 100644 --- a/packages/replay/jest.setup.ts +++ b/packages/replay/jest.setup.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access */ import { getCurrentHub } from '@sentry/core'; import type { ReplayRecordingData, Transport } from '@sentry/types'; +import * as SentryUtils from '@sentry/utils'; import { TextEncoder } from 'util'; import type { ReplayContainer, Session } from './src/types'; @@ -10,11 +11,7 @@ import type { ReplayContainer, Session } from './src/types'; type MockTransport = jest.MockedFunction; -jest.mock('./src/util/isBrowser', () => { - return { - isBrowser: () => true, - }; -}); +jest.spyOn(SentryUtils, 'isBrowser').mockImplementation(() => true); type EnvelopeHeader = { event_id: string; diff --git a/packages/replay/src/integration.ts b/packages/replay/src/integration.ts index 725a61681d1c..f0b07582ce61 100644 --- a/packages/replay/src/integration.ts +++ b/packages/replay/src/integration.ts @@ -1,6 +1,6 @@ import { getCurrentHub } from '@sentry/core'; import type { BrowserClientReplayOptions, Integration } from '@sentry/types'; -import { dropUndefinedKeys } from '@sentry/utils'; +import { dropUndefinedKeys, isBrowser } from '@sentry/utils'; import { DEFAULT_FLUSH_MAX_DELAY, @@ -12,7 +12,6 @@ import { import { ReplayContainer } from './replay'; import type { RecordingOptions, ReplayConfiguration, ReplayPluginOptions, SendBufferedReplayOptions } from './types'; import { getPrivacyOptions } from './util/getPrivacyOptions'; -import { isBrowser } from './util/isBrowser'; import { maskAttribute } from './util/maskAttribute'; const MEDIA_SELECTORS = diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 5bb54c52b9cd..454d441080ec 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -5,6 +5,7 @@ export * from './error'; export * from './worldwide'; export * from './instrument'; export * from './is'; +export * from './isBrowser'; export * from './logger'; export * from './memo'; export * from './misc'; diff --git a/packages/replay/src/util/isBrowser.ts b/packages/utils/src/isBrowser.ts similarity index 92% rename from packages/replay/src/util/isBrowser.ts rename to packages/utils/src/isBrowser.ts index 6a64317ba3fa..aa0a4bfa11db 100644 --- a/packages/replay/src/util/isBrowser.ts +++ b/packages/utils/src/isBrowser.ts @@ -1,4 +1,4 @@ -import { isNodeEnv } from '@sentry/utils'; +import { isNodeEnv } from './node'; /** * Returns true if we are in the browser.