|
1 |
| -import { assertSentryTransaction, getEnvelopeRequest, runServer } from '../../../utils'; |
| 1 | +import { assertSentryTransaction, getEnvelopeRequest, runServer, conditionalTest } from '../../../utils'; |
2 | 2 |
|
3 |
| -test('should instrument GraphQL and Apollo Server.', async () => { |
4 |
| - const url = await runServer(__dirname); |
5 |
| - const envelope = await getEnvelopeRequest(url); |
| 3 | +conditionalTest({ min: 12 })(() => { |
| 4 | + test('should instrument GraphQL and Apollo Server.', async () => { |
| 5 | + const url = await runServer(__dirname); |
| 6 | + const envelope = await getEnvelopeRequest(url); |
6 | 7 |
|
7 |
| - expect(envelope).toHaveLength(3); |
| 8 | + expect(envelope).toHaveLength(3); |
8 | 9 |
|
9 |
| - const transaction = envelope[2]; |
10 |
| - const parentSpanId = (transaction as any)?.contexts?.trace?.span_id; |
11 |
| - const graphqlSpanId = (transaction as any)?.spans?.[0].span_id; |
| 10 | + const transaction = envelope[2]; |
| 11 | + const parentSpanId = (transaction as any)?.contexts?.trace?.span_id; |
| 12 | + const graphqlSpanId = (transaction as any)?.spans?.[0].span_id; |
12 | 13 |
|
13 |
| - expect(parentSpanId).toBeDefined(); |
14 |
| - expect(graphqlSpanId).toBeDefined(); |
| 14 | + expect(parentSpanId).toBeDefined(); |
| 15 | + expect(graphqlSpanId).toBeDefined(); |
15 | 16 |
|
16 |
| - assertSentryTransaction(transaction, { |
17 |
| - transaction: 'test_transaction', |
18 |
| - spans: [ |
19 |
| - { |
20 |
| - description: 'execute', |
21 |
| - op: 'db.graphql', |
22 |
| - parent_span_id: parentSpanId, |
23 |
| - }, |
24 |
| - { |
25 |
| - description: 'Query.hello', |
26 |
| - op: 'db.graphql.apollo', |
27 |
| - parent_span_id: graphqlSpanId, |
28 |
| - }, |
29 |
| - ], |
| 17 | + assertSentryTransaction(transaction, { |
| 18 | + transaction: 'test_transaction', |
| 19 | + spans: [ |
| 20 | + { |
| 21 | + description: 'execute', |
| 22 | + op: 'db.graphql', |
| 23 | + parent_span_id: parentSpanId, |
| 24 | + }, |
| 25 | + { |
| 26 | + description: 'Query.hello', |
| 27 | + op: 'db.graphql.apollo', |
| 28 | + parent_span_id: graphqlSpanId, |
| 29 | + }, |
| 30 | + ], |
| 31 | + }); |
30 | 32 | });
|
31 | 33 | });
|
0 commit comments