Skip to content

Commit 5aa9e97

Browse files
committed
fix some open handle issues
1 parent c875852 commit 5aa9e97

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/core/test/lib/metrics/browser-aggregator.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { CounterMetric } from '../../../src/metrics/instance';
33
import { serializeMetricBuckets } from '../../../src/metrics/utils';
44
import { TestClient, getDefaultTestClientOptions } from '../../mocks/client';
55

6+
function _cleanupAggregator(aggregator: BrowserMetricsAggregator): void {
7+
clearInterval(aggregator['_interval']);
8+
}
9+
610
describe('BrowserMetricsAggregator', () => {
711
const options = getDefaultTestClientOptions({ tracesSampleRate: 0.0 });
812
const testClient = new TestClient(options);
@@ -21,6 +25,8 @@ describe('BrowserMetricsAggregator', () => {
2125
timestamp: expect.any(Number),
2226
unit: 'none',
2327
});
28+
29+
_cleanupAggregator(aggregator);
2430
});
2531

2632
it('groups same items together', () => {
@@ -40,6 +46,8 @@ describe('BrowserMetricsAggregator', () => {
4046
unit: 'none',
4147
});
4248
expect(firstValue.metric._value).toEqual(2);
49+
50+
_cleanupAggregator(aggregator);
4351
});
4452

4553
it('differentiates based on tag value', () => {
@@ -48,6 +56,8 @@ describe('BrowserMetricsAggregator', () => {
4856
expect(aggregator['_buckets'].size).toEqual(1);
4957
aggregator.add('g', 'cpu', 55, undefined, { a: 'value' });
5058
expect(aggregator['_buckets'].size).toEqual(2);
59+
60+
_cleanupAggregator(aggregator);
5161
});
5262

5363
describe('serializeBuckets', () => {
@@ -69,6 +79,8 @@ describe('BrowserMetricsAggregator', () => {
6979
expect(serializedBuckets).toContain('cpu@none:52:50:55:157:3|g|T');
7080
expect(serializedBuckets).toContain('lcp@second:1:1.2|d|#a:value,b:anothervalue|T');
7181
expect(serializedBuckets).toContain('important_people@none:97:98|s|#numericKey:2|T');
82+
83+
_cleanupAggregator(aggregator);
7284
});
7385
});
7486
});

0 commit comments

Comments
 (0)