Skip to content

Commit 79731ac

Browse files
committed
test: fix profiling tests
1 parent ecb8037 commit 79731ac

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/profiling-node/src/integration.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ export const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> =
404404
const options = client.getOptions();
405405

406406
const mode =
407-
(options.profilesSampleRate === undefined || options.profilesSampleRate === 0) && !options.profilesSampler
407+
(options.profilesSampleRate === undefined ||
408+
options.profilesSampleRate === null ||
409+
options.profilesSampleRate === 0) &&
410+
!options.profilesSampler
408411
? 'continuous'
409412
: 'span';
410413
switch (mode) {

packages/profiling-node/test/spanProfileUtils.test.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as Sentry from '@sentry/node';
22

33
import { getMainCarrier } from '@sentry/core';
4-
import { ProfilingIntegration } from '@sentry/types';
4+
import type { ProfilingIntegration } from '@sentry/types';
55
import type { NodeClientOptions } from '@sentry/node/build/types/types';
66
import type { ProfileChunk, Transport } from '@sentry/types';
77
import { GLOBAL_OBJ, createEnvelope, logger } from '@sentry/utils';
@@ -703,6 +703,10 @@ describe('span profiling mode', () => {
703703
});
704704
});
705705
describe('continuous profiling mode', () => {
706+
beforeEach(() => {
707+
jest.clearAllMocks();
708+
});
709+
706710
it.each([
707711
['profilesSampleRate=0', makeClientOptions({ profilesSampleRate: 0 })],
708712
['profilesSampleRate=undefined', makeClientOptions({ profilesSampleRate: undefined })],
@@ -776,5 +780,5 @@ describe('continuous profiling mode', () => {
776780
expect(startProfilingSpy).toHaveBeenCalledTimes(1);
777781
Sentry.profiler.stopProfiler();
778782
expect(stopProfilingSpy).toHaveBeenCalledTimes(1);
779-
})
783+
});
780784
});

0 commit comments

Comments
 (0)