-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
32 lines (29 loc) · 993 Bytes
/
test.ts
File metadata and controls
32 lines (29 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { expect, test } from 'vitest';
import { createRunner } from '../../../utils/runner';
test('beforeSendSpan applies changes to streamed span', async () => {
await createRunner(__dirname, 'scenario.ts')
.expect({
span: container => {
const spans = container.items;
expect(spans.length).toBe(2);
const customChildSpan = spans.find(s => s.name === 'customChildSpanName');
expect(customChildSpan).toBeDefined();
expect(customChildSpan!.attributes?.['sentry.custom_attribute']).toEqual({
type: 'string',
value: 'customAttributeValue',
});
expect(customChildSpan!.status).toBe('something');
expect(customChildSpan!.links).toEqual([
{
trace_id: '123',
span_id: '456',
attributes: {
'sentry.link.type': { type: 'string', value: 'custom_link' },
},
},
]);
},
})
.start()
.completed();
});