-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
34 lines (29 loc) · 1.22 KB
/
test.ts
File metadata and controls
34 lines (29 loc) · 1.22 KB
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
33
34
import { afterAll, describe, expect } from 'vitest';
import { cleanupChildProcesses, createEsmAndCjsTests } from '../../../utils/runner';
describe('httpIntegration-streamed', () => {
afterAll(() => {
cleanupChildProcesses();
});
createEsmAndCjsTests(__dirname, 'server.mjs', 'instrument.mjs', (createRunner, test) => {
test('infers sentry.op, name, and source for streamed server spans', async () => {
const runner = createRunner()
.expect({
span: container => {
const serverSpan = container.items.find(
item =>
item.attributes?.['sentry.op']?.type === 'string' &&
item.attributes['sentry.op'].value === 'http.server',
);
expect(serverSpan).toBeDefined();
expect(serverSpan?.is_segment).toBe(true);
expect(serverSpan?.name).toBe('GET /test');
expect(serverSpan?.attributes?.['sentry.source']).toEqual({ type: 'string', value: 'route' });
expect(serverSpan?.attributes?.['sentry.span.source']).toEqual({ type: 'string', value: 'route' });
},
})
.start();
await runner.makeRequest('get', '/test');
await runner.completed();
});
});
});