Skip to content

Commit 992b591

Browse files
committed
fix gatsby test
1 parent 0ba634a commit 992b591

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

packages/gatsby/test/gatsby-browser.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ describe('onClientEntry', () => {
5353
environment: process.env.NODE_ENV,
5454
integrations: [],
5555
release: (global as any).__SENTRY_RELEASE__,
56-
tracesSampleRate: 0,
5756
});
5857
});
5958

@@ -100,6 +99,16 @@ describe('onClientEntry', () => {
10099
);
101100
});
102101

102+
it('sets a tracesSampler if defined as option', () => {
103+
const tracesSampler = jest.fn();
104+
onClientEntry(undefined, { tracesSampler });
105+
expect(sentryInit).toHaveBeenLastCalledWith(
106+
expect.objectContaining({
107+
tracesSampler,
108+
}),
109+
);
110+
});
111+
103112
it('adds `BrowserTracing` integration if tracesSampleRate is defined', () => {
104113
onClientEntry(undefined, { tracesSampleRate: 0.5 });
105114
expect(sentryInit).toHaveBeenLastCalledWith(
@@ -109,6 +118,16 @@ describe('onClientEntry', () => {
109118
);
110119
});
111120

121+
it('adds `BrowserTracing` integration if tracesSampler is defined', () => {
122+
const tracesSampler = jest.fn();
123+
onClientEntry(undefined, { tracesSampler });
124+
expect(sentryInit).toHaveBeenLastCalledWith(
125+
expect.objectContaining({
126+
integrations: [expect.objectContaining({ name: 'BrowserTracing' })],
127+
}),
128+
);
129+
});
130+
112131
it('only defines a single `BrowserTracing` integration', () => {
113132
const Tracing = jest.requireActual('@sentry/tracing');
114133
const integrations = [new Tracing.Integrations.BrowserTracing()];

0 commit comments

Comments
 (0)