|
1 | 1 | import { join } from 'path'; |
| 2 | +import { conditionalTest } from '../../../../utils'; |
2 | 3 | import { createRunner } from '../../../../utils/runner'; |
3 | 4 | import { createTestServer } from '../../../../utils/server'; |
4 | 5 |
|
5 | | -test('outgoing sampled http requests are correctly instrumented in ESM', done => { |
6 | | - expect.assertions(11); |
| 6 | +conditionalTest({ min: 18 })('outgoing sampled http requests are correctly instrumented in ESM', () => { |
| 7 | + test('outgoing sampled http requests are correctly instrumented in ESM', done => { |
| 8 | + expect.assertions(11); |
7 | 9 |
|
8 | | - createTestServer(done) |
9 | | - .get('/api/v0', headers => { |
10 | | - expect(headers['baggage']).toEqual(expect.any(String)); |
11 | | - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); |
12 | | - expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); |
13 | | - }) |
14 | | - .get('/api/v1', headers => { |
15 | | - expect(headers['baggage']).toEqual(expect.any(String)); |
16 | | - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); |
17 | | - expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); |
18 | | - }) |
19 | | - .get('/api/v2', headers => { |
20 | | - expect(headers['baggage']).toBeUndefined(); |
21 | | - expect(headers['sentry-trace']).toBeUndefined(); |
22 | | - }) |
23 | | - .get('/api/v3', headers => { |
24 | | - expect(headers['baggage']).toBeUndefined(); |
25 | | - expect(headers['sentry-trace']).toBeUndefined(); |
26 | | - }) |
27 | | - .start() |
28 | | - .then(([SERVER_URL, closeTestServer]) => { |
29 | | - const instrumentPath = join(__dirname, 'instrument.mjs'); |
30 | | - createRunner(__dirname, 'scenario.mjs') |
31 | | - .withFlags('--import', instrumentPath) |
32 | | - .withEnv({ SERVER_URL }) |
33 | | - .expect({ |
34 | | - transaction: { |
35 | | - // we're not too concerned with the actual transaction here since this is tested elsewhere |
36 | | - }, |
37 | | - }) |
38 | | - .start(closeTestServer); |
39 | | - }); |
| 10 | + createTestServer(done) |
| 11 | + .get('/api/v0', headers => { |
| 12 | + expect(headers['baggage']).toEqual(expect.any(String)); |
| 13 | + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); |
| 14 | + expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); |
| 15 | + }) |
| 16 | + .get('/api/v1', headers => { |
| 17 | + expect(headers['baggage']).toEqual(expect.any(String)); |
| 18 | + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); |
| 19 | + expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); |
| 20 | + }) |
| 21 | + .get('/api/v2', headers => { |
| 22 | + expect(headers['baggage']).toBeUndefined(); |
| 23 | + expect(headers['sentry-trace']).toBeUndefined(); |
| 24 | + }) |
| 25 | + .get('/api/v3', headers => { |
| 26 | + expect(headers['baggage']).toBeUndefined(); |
| 27 | + expect(headers['sentry-trace']).toBeUndefined(); |
| 28 | + }) |
| 29 | + .start() |
| 30 | + .then(([SERVER_URL, closeTestServer]) => { |
| 31 | + const instrumentPath = join(__dirname, 'instrument.mjs'); |
| 32 | + createRunner(__dirname, 'scenario.mjs') |
| 33 | + .withFlags('--import', instrumentPath) |
| 34 | + .withEnv({ SERVER_URL }) |
| 35 | + .expect({ |
| 36 | + transaction: { |
| 37 | + // we're not too concerned with the actual transaction here since this is tested elsewhere |
| 38 | + }, |
| 39 | + }) |
| 40 | + .start(closeTestServer); |
| 41 | + }); |
| 42 | + }); |
40 | 43 | }); |
0 commit comments