Skip to content

Commit d7de20e

Browse files
authored
ref: Move isBrowser util fn from replay to util (#9289)
We need this in the new feedback integration.
1 parent 7935e78 commit d7de20e

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

packages/replay/jest.setup.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
import { getCurrentHub } from '@sentry/core';
33
import type { ReplayRecordingData, Transport } from '@sentry/types';
4+
import * as SentryUtils from '@sentry/utils';
45
import { TextEncoder } from 'util';
56

67
import type { ReplayContainer, Session } from './src/types';
@@ -10,11 +11,7 @@ import type { ReplayContainer, Session } from './src/types';
1011

1112
type MockTransport = jest.MockedFunction<Transport['send']>;
1213

13-
jest.mock('./src/util/isBrowser', () => {
14-
return {
15-
isBrowser: () => true,
16-
};
17-
});
14+
jest.spyOn(SentryUtils, 'isBrowser').mockImplementation(() => true);
1815

1916
type EnvelopeHeader = {
2017
event_id: string;

packages/replay/src/integration.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getCurrentHub } from '@sentry/core';
22
import type { BrowserClientReplayOptions, Integration } from '@sentry/types';
3-
import { dropUndefinedKeys } from '@sentry/utils';
3+
import { dropUndefinedKeys, isBrowser } from '@sentry/utils';
44

55
import {
66
DEFAULT_FLUSH_MAX_DELAY,
@@ -12,7 +12,6 @@ import {
1212
import { ReplayContainer } from './replay';
1313
import type { RecordingOptions, ReplayConfiguration, ReplayPluginOptions, SendBufferedReplayOptions } from './types';
1414
import { getPrivacyOptions } from './util/getPrivacyOptions';
15-
import { isBrowser } from './util/isBrowser';
1615
import { maskAttribute } from './util/maskAttribute';
1716

1817
const MEDIA_SELECTORS =

packages/utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export * from './error';
55
export * from './worldwide';
66
export * from './instrument';
77
export * from './is';
8+
export * from './isBrowser';
89
export * from './logger';
910
export * from './memo';
1011
export * from './misc';

packages/replay/src/util/isBrowser.ts renamed to packages/utils/src/isBrowser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isNodeEnv } from '@sentry/utils';
1+
import { isNodeEnv } from './node';
22

33
/**
44
* Returns true if we are in the browser.

0 commit comments

Comments
 (0)