Skip to content

Commit

Permalink
fix(test): import extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasBa committed Dec 16, 2021
1 parent a725360 commit f87b66d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/tracing/test/browser/backgroundtab.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Hub, makeMain } from '@sentry/hub';
import { JSDOM } from 'jsdom';

import { registerBackgroundTabDetection } from '../../src/browser/backgroundtab';
import { addExtensionMethods } from '../../src/hubextensions';

describe('registerBackgroundTabDetection', () => {
let events: Record<string, any> = {};
Expand All @@ -15,6 +16,9 @@ describe('registerBackgroundTabDetection', () => {
hub = new Hub(new BrowserClient({ tracesSampleRate: 1 }));
makeMain(hub);

// If we do not add extension methods, invoking hub.startTransaction returns undefined
addExtensionMethods();

// @ts-ignore need to override global document
global.document.addEventListener = jest.fn((event, callback) => {
events[event] = callback;
Expand Down

0 comments on commit f87b66d

Please sign in to comment.