Skip to content

Commit 087fe97

Browse files
committed
Add integration tests
1 parent 12cdb0f commit 087fe97

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const chicken = {};
2+
const egg = { contains: chicken };
3+
chicken.lays = egg;
4+
5+
const circularObject = chicken;
6+
7+
const transaction = Sentry.startTransaction({ name: 'circular_object_test_transaction', data: circularObject });
8+
const span = transaction.startChild({ op: 'circular_object_test_span', data: circularObject });
9+
10+
span.finish();
11+
transaction.finish();
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { expect } from '@playwright/test';
2+
import { Event } from '@sentry/types';
3+
4+
import { sentryTest } from '../../../../utils/fixtures';
5+
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
6+
7+
sentryTest('should be able to handle circular data', async ({ getLocalTestPath, page }) => {
8+
const url = await getLocalTestPath({ testDir: __dirname });
9+
const eventData = await getFirstSentryEnvelopeRequest<Event>(page, url);
10+
11+
expect(eventData.type).toBe('transaction');
12+
expect(eventData.transaction).toBe('circular_object_test_transaction');
13+
14+
expect(eventData.contexts).toMatchObject({
15+
trace: {
16+
data: { lays: { contains: { lays: { contains: '[Circular ~]' } } } },
17+
},
18+
});
19+
20+
expect(eventData?.spans?.[0]).toMatchObject({
21+
data: { lays: { contains: '[Circular ~]' } },
22+
op: 'circular_object_test_span',
23+
});
24+
25+
await new Promise(resolve => setTimeout(resolve, 2000));
26+
});

packages/integration-tests/suites/public-api/startTransaction/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ window.Sentry = Sentry;
77
Sentry.init({
88
dsn: 'https://public@dsn.ingest.sentry.io/1337',
99
tracesSampleRate: 1.0,
10+
normalizeDepth: 10,
1011
});

0 commit comments

Comments
 (0)