Skip to content

Commit fed3fd0

Browse files
committed
fix tracing unit tests
1 parent bb8f917 commit fed3fd0

File tree

6 files changed

+57
-51
lines changed

6 files changed

+57
-51
lines changed

packages/tracing/test/browser/backgroundtab.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BrowserClient } from '@sentry/browser';
22
import { setupBrowserTransport } from '@sentry/browser/src/transports';
3+
import { getDefaultBrowserClientOptions } from '@sentry/browser/test/unit/helper/browser-client-options';
34
import { Hub, makeMain } from '@sentry/hub';
45
import { JSDOM } from 'jsdom';
56

@@ -14,7 +15,7 @@ describe('registerBackgroundTabDetection', () => {
1415
// @ts-ignore need to override global document
1516
global.document = dom.window.document;
1617

17-
const options = { tracesSampleRate: 1 };
18+
const options = getDefaultBrowserClientOptions({ tracesSampleRate: 1 });
1819
hub = new Hub(new BrowserClient(options, setupBrowserTransport(options).transport));
1920
makeMain(hub);
2021

packages/tracing/test/browser/browsertracing.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BrowserClient } from '@sentry/browser';
22
import { setupBrowserTransport } from '@sentry/browser/src/transports';
3+
import { getDefaultBrowserClientOptions } from '@sentry/browser/test/unit/helper/browser-client-options';
34
import { Hub, makeMain } from '@sentry/hub';
45
import { getGlobalObject, InstrumentHandlerCallback, InstrumentHandlerType } from '@sentry/utils';
56
import { JSDOM } from 'jsdom';
@@ -52,7 +53,7 @@ describe('BrowserTracing', () => {
5253
let hub: Hub;
5354
beforeEach(() => {
5455
jest.useFakeTimers();
55-
const options = { tracesSampleRate: 1 };
56+
const options = getDefaultBrowserClientOptions({ tracesSampleRate: 1 });
5657
hub = new Hub(new BrowserClient(options, setupBrowserTransport(options).transport));
5758
makeMain(hub);
5859
document.head.innerHTML = '';
@@ -474,7 +475,7 @@ describe('BrowserTracing', () => {
474475
getGlobalObject<Window>().location = dogParkLocation as any;
475476

476477
const tracesSampler = jest.fn();
477-
const options = { tracesSampler };
478+
const options = getDefaultBrowserClientOptions({ tracesSampler });
478479
hub.bindClient(new BrowserClient(options, setupBrowserTransport(options).transport));
479480
// setting up the BrowserTracing integration automatically starts a pageload transaction
480481
createBrowserTracing(true);
@@ -491,7 +492,7 @@ describe('BrowserTracing', () => {
491492
getGlobalObject<Window>().location = dogParkLocation as any;
492493

493494
const tracesSampler = jest.fn();
494-
const options = { tracesSampler };
495+
const options = getDefaultBrowserClientOptions({ tracesSampler });
495496
hub.bindClient(new BrowserClient(options, setupBrowserTransport(options).transport));
496497
// setting up the BrowserTracing integration normally automatically starts a pageload transaction, but that's not
497498
// what we're testing here

packages/tracing/test/browser/request.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BrowserClient } from '@sentry/browser';
22
import { setupBrowserTransport } from '@sentry/browser/src/transports';
3+
import { getDefaultBrowserClientOptions } from '@sentry/browser/test/unit/helper/browser-client-options';
34
import { Hub, makeMain } from '@sentry/hub';
45
import * as utils from '@sentry/utils';
56

@@ -73,7 +74,7 @@ describe('callbacks', () => {
7374
};
7475

7576
beforeAll(() => {
76-
const options = { tracesSampleRate: 1 };
77+
const options = getDefaultBrowserClientOptions({ tracesSampleRate: 1 });
7778
hub = new Hub(new BrowserClient(options, setupBrowserTransport(options).transport));
7879
makeMain(hub);
7980
});

0 commit comments

Comments
 (0)