diff --git a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts index 4637fcc5555d..bb963a975049 100644 --- a/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts +++ b/dev-packages/browser-integration-tests/suites/manual-client/browser-context/test.ts @@ -46,7 +46,7 @@ sentryTest('allows to setup a client manually & capture exceptions', async ({ ge }, }, contexts: { - trace: { trace_id: expect.stringMatching(/[a-f0-9]{32}/), span_id: expect.stringMatching(/[a-f0-9]{16}/) }, + trace: { trace_id: expect.stringMatching(/[a-f\d]{32}/), span_id: expect.stringMatching(/[a-f\d]{16}/) }, }, }); }); diff --git a/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_multiple-chunks/test.ts b/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_multiple-chunks/test.ts index 702140b8823e..421cdfc1e645 100644 --- a/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_multiple-chunks/test.ts +++ b/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_multiple-chunks/test.ts @@ -58,9 +58,9 @@ sentryTest( // Required profile metadata (Sample Format V2) expect(typeof envelopeItemPayload1.profiler_id).toBe('string'); - expect(envelopeItemPayload1.profiler_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload1.profiler_id).toMatch(/^[a-f\d]{32}$/); expect(typeof envelopeItemPayload1.chunk_id).toBe('string'); - expect(envelopeItemPayload1.chunk_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload1.chunk_id).toMatch(/^[a-f\d]{32}$/); expect(envelopeItemPayload1.client_sdk).toBeDefined(); expect(typeof envelopeItemPayload1.client_sdk.name).toBe('string'); expect(typeof envelopeItemPayload1.client_sdk.version).toBe('string'); @@ -170,9 +170,9 @@ sentryTest( // Required profile metadata (Sample Format V2) // https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/ expect(typeof envelopeItemPayload2.profiler_id).toBe('string'); - expect(envelopeItemPayload2.profiler_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload2.profiler_id).toMatch(/^[a-f\d]{32}$/); expect(typeof envelopeItemPayload2.chunk_id).toBe('string'); - expect(envelopeItemPayload2.chunk_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload2.chunk_id).toMatch(/^[a-f\d]{32}$/); expect(envelopeItemPayload2.client_sdk).toBeDefined(); expect(typeof envelopeItemPayload2.client_sdk.name).toBe('string'); expect(typeof envelopeItemPayload2.client_sdk.version).toBe('string'); diff --git a/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_overlapping-spans/test.ts b/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_overlapping-spans/test.ts index 60744def96cd..161f74d64e83 100644 --- a/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_overlapping-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/profiling/traceLifecycleMode_overlapping-spans/test.ts @@ -60,9 +60,9 @@ sentryTest( // Required profile metadata (Sample Format V2) // https://develop.sentry.dev/sdk/telemetry/profiles/sample-format-v2/ expect(typeof envelopeItemPayload.profiler_id).toBe('string'); - expect(envelopeItemPayload.profiler_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload.profiler_id).toMatch(/^[a-f\d]{32}$/); expect(typeof envelopeItemPayload.chunk_id).toBe('string'); - expect(envelopeItemPayload.chunk_id).toMatch(/^[a-f0-9]{32}$/); + expect(envelopeItemPayload.chunk_id).toMatch(/^[a-f\d]{32}$/); expect(envelopeItemPayload.client_sdk).toBeDefined(); expect(typeof envelopeItemPayload.client_sdk.name).toBe('string'); expect(typeof envelopeItemPayload.client_sdk.version).toBe('string'); @@ -175,7 +175,7 @@ sentryTest('attaches thread data to child spans (trace mode)', async ({ page, ge const profilerId = rootSpan?.contexts?.profile?.profiler_id as string | undefined; expect(typeof profilerId).toBe('string'); - expect(profilerId).toMatch(/^[a-f0-9]{32}$/); + expect(profilerId).toMatch(/^[a-f\d]{32}$/); const spans = (rootSpan?.spans ?? []) as Array<{ data?: Record }>; expect(spans.length).toBeGreaterThan(0); diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts index 8493f4e5fd97..c1e641204b81 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone-mixed-transaction/test.ts @@ -34,8 +34,8 @@ sentryTest( const traceId = transactionEnvelopeHeader.trace!.trace_id!; const parentSpanId = transactionEnvelopeItem.contexts?.trace?.span_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); - expect(parentSpanId).toMatch(/[a-f0-9]{16}/); + expect(traceId).toMatch(/[a-f\d]{32}/); + expect(parentSpanId).toMatch(/[a-f\d]{16}/); expect(spanEnvelopeHeader).toEqual({ sent_at: expect.any(String), @@ -76,7 +76,7 @@ sentryTest( segment_id: transactionEnvelopeItem.contexts?.trace?.span_id, parent_span_id: parentSpanId, origin: 'manual', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, @@ -111,7 +111,7 @@ sentryTest( description: 'inner', origin: 'manual', parent_span_id: parentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts index aaafd99c91d5..289e907e09b3 100644 --- a/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts +++ b/dev-packages/browser-integration-tests/suites/public-api/startSpan/standalone/test.ts @@ -48,10 +48,10 @@ sentryTest('sends a segment span envelope', async ({ getLocalTestUrl, page }) => }, description: 'standalone_segment_span', origin: 'manual', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), is_segment: true, segment_id: spanJson.span_id, }); diff --git a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts index ef0882e0206b..e63c45e42293 100644 --- a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts @@ -57,7 +57,7 @@ sentryTest( expect(envHeader.trace).toEqual({ environment: 'production', sample_rate: '1', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', replay_id: replay.session?.id, sampled: 'true', @@ -105,7 +105,7 @@ sentryTest( expect(envHeader.trace).toEqual({ environment: 'production', sample_rate: '1', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', sampled: 'true', sample_rand: expect.any(String), @@ -158,7 +158,7 @@ sentryTest( expect(envHeader.trace).toEqual({ environment: 'production', sample_rate: '1', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', replay_id: replay.session?.id, sampled: 'true', @@ -201,7 +201,7 @@ sentryTest( expect(envHeader.trace).toEqual({ environment: 'production', sample_rate: '1', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', sampled: 'true', sample_rand: expect.any(String), @@ -243,7 +243,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({ expect(error1Header.trace).toBeDefined(); expect(error1Header.trace).toEqual({ environment: 'production', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', replay_id: replay.session?.id, ...(hasTracing @@ -265,7 +265,7 @@ sentryTest('should add replay_id to error DSC while replay is active', async ({ expect(error2Header.trace).toBeDefined(); expect(error2Header.trace).toEqual({ environment: 'production', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', ...(hasTracing ? { diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts index 633be5f570b5..6894d7407349 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/http-timings/test.ts @@ -34,7 +34,7 @@ sentryTest('creates fetch spans with http timing', async ({ browserName, getLoca expect(span).toMatchObject({ description: `GET http://sentry-test-site.example/${index}`, parent_span_id: tracingEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-negative/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-negative/test.ts index 6ec7985b9dad..c8faee2f5feb 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-negative/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-negative/test.ts @@ -60,7 +60,7 @@ sentryTest.describe('When `consistentTraceSampling` is `true` and page contains expect(extractTraceparentData(sentryTrace)).toEqual({ traceId: expect.not.stringContaining(metaTagTraceId), - parentSpanId: expect.stringMatching(/^[0-9a-f]{16}$/), + parentSpanId: expect.stringMatching(/^[\da-f]{16}$/), parentSampled: false, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-precedence/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-precedence/test.ts index ece2b1f85790..3dab9594ba7c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-precedence/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/meta-precedence/test.ts @@ -48,7 +48,7 @@ sentryTest.describe('When `consistentTraceSampling` is `true` and page contains expect(extractTraceparentData(sentryTrace)).toEqual({ traceId: expect.not.stringContaining(metaTagTraceIdIndex), - parentSpanId: expect.stringMatching(/^[0-9a-f]{16}$/), + parentSpanId: expect.stringMatching(/^[\da-f]{16}$/), parentSampled: false, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/tracesSampler-precedence/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/tracesSampler-precedence/test.ts index 9e896798be90..2bb196c898fd 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/tracesSampler-precedence/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/consistent-sampling/tracesSampler-precedence/test.ts @@ -104,8 +104,8 @@ sentryTest.describe('When `consistentTraceSampling` is `true`', () => { { attributes: { 'sentry.link.type': 'previous_trace' }, sampled: false, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), }, ]); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/negatively-sampled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/negatively-sampled/test.ts index 7a8b69fdb364..b84aefb8887d 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/negatively-sampled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/linked-traces/negatively-sampled/test.ts @@ -24,8 +24,8 @@ sentryTest('includes a span link to a previously negatively sampled span', async expect(navigationTraceContext?.op).toBe('navigation'); expect(navigationTraceContext?.links).toEqual([ { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), sampled: false, attributes: { [SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE]: 'previous_trace', @@ -34,7 +34,7 @@ sentryTest('includes a span link to a previously negatively sampled span', async ]); expect(navigationTraceContext?.data).toMatchObject({ - 'sentry.previous_trace': expect.stringMatching(/[a-f0-9]{32}-[a-f0-9]{16}-0/), + 'sentry.previous_trace': expect.stringMatching(/[a-f\d]{32}-[a-f\d]{16}-0/), }); expect(navigationTraceContext?.trace_id).not.toEqual(navigationTraceContext?.links![0].trace_id); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors-meta/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors-meta/test.ts index 5bed055dbc0a..ca716b2e2648 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors-meta/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors-meta/test.ts @@ -24,12 +24,12 @@ sentryTest('errors in TwP mode have same trace ID & span IDs', async ({ getLocal // Span ID is a virtual span, not the propagated one expect(spanId1).not.toEqual(spanId); - expect(spanId1).toMatch(/^[a-f0-9]{16}$/); + expect(spanId1).toMatch(/^[a-f\d]{16}$/); const contexts2 = event2.contexts; const { trace_id: traceId2, span_id: spanId2 } = contexts2?.trace || {}; expect(traceId2).toEqual(traceId); - expect(spanId2).toMatch(/^[a-f0-9]{16}$/); + expect(spanId2).toMatch(/^[a-f\d]{16}$/); expect(spanId2).toEqual(spanId1); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors/test.ts index 3048de92b2f1..fa579509ba87 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/twp-errors/test.ts @@ -17,13 +17,13 @@ sentryTest('errors in TwP mode have same trace ID & span IDs', async ({ getLocal const contexts1 = event1.contexts; const { trace_id: traceId1, span_id: spanId1 } = contexts1?.trace || {}; - expect(traceId1).toMatch(/^[a-f0-9]{32}$/); - expect(spanId1).toMatch(/^[a-f0-9]{16}$/); + expect(traceId1).toMatch(/^[a-f\d]{32}$/); + expect(spanId1).toMatch(/^[a-f\d]{16}$/); const contexts2 = event2.contexts; const { trace_id: traceId2, span_id: spanId2 } = contexts2?.trace || {}; - expect(traceId2).toMatch(/^[a-f0-9]{32}$/); - expect(spanId2).toMatch(/^[a-f0-9]{16}$/); + expect(traceId2).toMatch(/^[a-f\d]{32}$/); + expect(spanId2).toMatch(/^[a-f\d]{16}$/); expect(traceId2).toEqual(traceId1); expect(spanId2).toEqual(spanId1); diff --git a/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts b/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts index 0136b1043617..7d33497a988b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/dsc-txn-name-update/test.ts @@ -48,7 +48,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn return (window as any).__traceId; }); - expect(traceId).toMatch(/^[0-9a-f]{32}$/); + expect(traceId).toMatch(/^[\da-f]{32}$/); // 2 const baggageItems = await makeRequestAndGetBaggageItems(page); @@ -56,7 +56,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.1.1', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -83,7 +83,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.1.1', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -112,7 +112,7 @@ sentryTest('updates the DSC when the txn name is updated and high-quality', asyn 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.1.1', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, diff --git a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts index 88a268e69ea2..23043ebc770d 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/envelope-header-transaction-name/test.ts @@ -23,7 +23,7 @@ sentryTest( environment: 'production', sample_rate: '1', transaction: expect.stringContaining('/index.html'), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', sampled: 'true', sample_rand: expect.any(String), diff --git a/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts b/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts index 9274cd0bb8ba..7617b498efb2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/envelope-header/test.ts @@ -26,7 +26,7 @@ sentryTest( expect(envHeader.trace).toEqual({ environment: 'production', sample_rate: '1', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', sampled: 'true', sample_rand: expect.any(String), diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts index f748c339ce14..91c8ec9ff216 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/pageload-resource-spans/test.ts @@ -104,7 +104,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU op: 'resource.img', origin: 'auto.resource.browser.metrics', parent_span_id: spanId, - span_id: expect.stringMatching(/^[a-f0-9]{16}$/), + span_id: expect.stringMatching(/^[a-f\d]{16}$/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, @@ -151,7 +151,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU op: 'resource.link', origin: 'auto.resource.browser.metrics', parent_span_id: spanId, - span_id: expect.stringMatching(/^[a-f0-9]{16}$/), + span_id: expect.stringMatching(/^[a-f\d]{16}$/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, @@ -192,7 +192,7 @@ sentryTest('adds resource spans to pageload transaction', async ({ getLocalTestU op: 'resource.script', origin: 'auto.resource.browser.metrics', parent_span_id: spanId, - span_id: expect.stringMatching(/^[a-f0-9]{16}$/), + span_id: expect.stringMatching(/^[a-f\d]{16}$/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts index 24c949c63afa..fd4b3b8fa06b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-cls-standalone-spans/test.ts @@ -68,7 +68,7 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a 'sentry.report_event': 'pagehide', transaction: expect.stringContaining('index.html'), 'user_agent.original': expect.stringContaining('Chrome'), - 'sentry.pageload.span_id': expect.stringMatching(/[a-f0-9]{16}/), + 'sentry.pageload.span_id': expect.stringMatching(/[a-f\d]{16}/), 'cls.source.1': expect.stringContaining('body > div#content > p'), }, description: expect.stringContaining('body > div#content > p'), @@ -81,12 +81,12 @@ sentryTest('captures a "GOOD" CLS vital with its source as a standalone span', a }, op: 'ui.webvital.cls', origin: 'auto.http.browser.cls', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - segment_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + segment_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: spanEnvelopeItem.start_timestamp, - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // Flakey value dependent on timings -> we check for a range @@ -138,7 +138,7 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as 'sentry.report_event': 'pagehide', transaction: expect.stringContaining('index.html'), 'user_agent.original': expect.stringContaining('Chrome'), - 'sentry.pageload.span_id': expect.stringMatching(/[a-f0-9]{16}/), + 'sentry.pageload.span_id': expect.stringMatching(/[a-f\d]{16}/), 'cls.source.1': expect.stringContaining('body > div#content > p'), }, description: expect.stringContaining('body > div#content > p'), @@ -151,12 +151,12 @@ sentryTest('captures a "MEH" CLS vital with its source as a standalone span', as }, op: 'ui.webvital.cls', origin: 'auto.http.browser.cls', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - segment_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + segment_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: spanEnvelopeItem.start_timestamp, - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // Flakey value dependent on timings -> we check for a range @@ -206,7 +206,7 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', 'sentry.report_event': 'pagehide', transaction: expect.stringContaining('index.html'), 'user_agent.original': expect.stringContaining('Chrome'), - 'sentry.pageload.span_id': expect.stringMatching(/[a-f0-9]{16}/), + 'sentry.pageload.span_id': expect.stringMatching(/[a-f\d]{16}/), 'cls.source.1': expect.stringContaining('body > div#content > p'), }, description: expect.stringContaining('body > div#content > p'), @@ -219,12 +219,12 @@ sentryTest('captures a "POOR" CLS vital with its source as a standalone span.', }, op: 'ui.webvital.cls', origin: 'auto.http.browser.cls', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - segment_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + segment_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: spanEnvelopeItem.start_timestamp, - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // Flakey value dependent on timings -> we check for a range @@ -275,7 +275,7 @@ sentryTest( 'sentry.report_event': 'pagehide', transaction: expect.stringContaining('index.html'), 'user_agent.original': expect.stringContaining('Chrome'), - 'sentry.pageload.span_id': expect.stringMatching(/[a-f0-9]{16}/), + 'sentry.pageload.span_id': expect.stringMatching(/[a-f\d]{16}/), }, description: 'Layout shift', exclusive_time: 0, @@ -287,12 +287,12 @@ sentryTest( }, op: 'ui.webvital.cls', origin: 'auto.http.browser.cls', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - segment_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + segment_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: spanEnvelopeItem.start_timestamp, - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); expect(spanEnvelopeHeaders).toEqual({ @@ -323,8 +323,8 @@ sentryTest( const pageloadSpanId = eventData.contexts?.trace?.span_id; const pageloadTraceId = eventData.contexts?.trace?.trace_id; - expect(pageloadSpanId).toMatch(/[a-f0-9]{16}/); - expect(pageloadTraceId).toMatch(/[a-f0-9]{32}/); + expect(pageloadSpanId).toMatch(/[a-f\d]{16}/); + expect(pageloadTraceId).toMatch(/[a-f\d]{32}/); const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, @@ -371,7 +371,7 @@ sentryTest('sends CLS of the initial page when soft-navigating to a new page', a await page.goto(`${url}#soft-navigation`); const pageloadTraceId = pageloadEventData.contexts?.trace?.trace_id; - expect(pageloadTraceId).toMatch(/[a-f0-9]{32}/); + expect(pageloadTraceId).toMatch(/[a-f\d]{32}/); const spanEnvelope = (await spanEnvelopePromise)[0]; const spanEnvelopeItem = spanEnvelope[1][0][1]; diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts index 942230b4594e..a882c06c1e11 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-late/test.ts @@ -43,7 +43,7 @@ sentryTest('should capture an INP click event span after pageload', async ({ bro const spanEnvelopeItem = spanEnvelope[1][0][1]; const traceId = spanEnvelopeHeaders.trace!.trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanEnvelopeHeaders).toEqual({ sent_at: expect.any(String), @@ -81,7 +81,7 @@ sentryTest('should capture an INP click event span after pageload', async ({ bro origin: 'auto.http.browser.inp', is_segment: true, segment_id: spanEnvelopeItem.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts index 435ed8398668..d1dea39f0231 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized-late/test.ts @@ -45,7 +45,7 @@ sentryTest( const spanEnvelopeItem = spanEnvelope[1][0][1]; const traceId = spanEnvelopeHeaders.trace!.trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanEnvelopeHeaders).toEqual({ sent_at: expect.any(String), @@ -84,7 +84,7 @@ sentryTest( origin: 'auto.http.browser.inp', is_segment: true, segment_id: spanEnvelopeItem.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts index 9d83d2608893..a7d614147f83 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp-parametrized/test.ts @@ -43,7 +43,7 @@ sentryTest( const spanEnvelopeItem = spanEnvelope[1][0][1]; const traceId = spanEnvelopeHeaders.trace!.trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanEnvelopeHeaders).toEqual({ sent_at: expect.any(String), @@ -81,8 +81,8 @@ sentryTest( origin: 'auto.http.browser.inp', segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!), // parent is the pageload span - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts index bf85d0ad99af..ee92b13802ec 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-inp/test.ts @@ -42,7 +42,7 @@ sentryTest('should capture an INP click event span during pageload', async ({ br const spanEnvelopeItem = spanEnvelope[1][0][1]; const traceId = spanEnvelopeHeaders.trace!.trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanEnvelopeHeaders).toEqual({ sent_at: expect.any(String), @@ -80,8 +80,8 @@ sentryTest('should capture an INP click event span during pageload', async ({ br origin: 'auto.http.browser.inp', segment_id: expect.not.stringMatching(spanEnvelopeItem.span_id!), // Parent is the pageload span - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: traceId, diff --git a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-standalone-spans/test.ts b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-standalone-spans/test.ts index ad21a6240793..e2b8a3e66e44 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-standalone-spans/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp-standalone-spans/test.ts @@ -57,7 +57,7 @@ sentryTest('captures LCP vital as a standalone span', async ({ getLocalTestUrl, const spanEnvelopeItem = spanEnvelope[1][0][1]; const pageloadTraceId = pageloadTransactionEvent.contexts?.trace?.trace_id; - expect(pageloadTraceId).toMatch(/[a-f0-9]{32}/); + expect(pageloadTraceId).toMatch(/[a-f\d]{32}/); expect(spanEnvelopeItem).toEqual({ data: { @@ -67,7 +67,7 @@ sentryTest('captures LCP vital as a standalone span', async ({ getLocalTestUrl, 'sentry.report_event': 'pagehide', transaction: expect.stringContaining('index.html'), 'user_agent.original': expect.stringContaining('Chrome'), - 'sentry.pageload.span_id': expect.stringMatching(/[a-f0-9]{16}/), + 'sentry.pageload.span_id': expect.stringMatching(/[a-f\d]{16}/), 'lcp.element': 'body > img', 'lcp.loadTime': expect.any(Number), 'lcp.renderTime': expect.any(Number), @@ -84,9 +84,9 @@ sentryTest('captures LCP vital as a standalone span', async ({ getLocalTestUrl, }, op: 'ui.webvital.lcp', origin: 'auto.http.browser.lcp', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), - segment_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + segment_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: spanEnvelopeItem.start_timestamp, // LCP is a point-in-time metric trace_id: pageloadTraceId, @@ -126,8 +126,8 @@ sentryTest('LCP span is linked to pageload transaction', async ({ getLocalTestUr const pageloadSpanId = eventData.contexts?.trace?.span_id; const pageloadTraceId = eventData.contexts?.trace?.trace_id; - expect(pageloadSpanId).toMatch(/[a-f0-9]{16}/); - expect(pageloadTraceId).toMatch(/[a-f0-9]{32}/); + expect(pageloadSpanId).toMatch(/[a-f\d]{16}/); + expect(pageloadTraceId).toMatch(/[a-f\d]{32}/); const spanEnvelopePromise = getMultipleSentryEnvelopeRequests( page, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-immediate/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-immediate/test.ts index 7d11168acb1a..f73689554e91 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-immediate/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-immediate/test.ts @@ -25,7 +25,7 @@ sentryTest('should create spans for fetch requests called directly after init', expect(requestSpans![0]).toMatchObject({ description: 'GET http://sentry-test-site.example/0', parent_span_id: tracingEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-propagateTraceparent/test.ts index d0aedc65bac8..a580e75415ce 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-propagateTraceparent/test.ts @@ -27,8 +27,8 @@ sentryTest( const requestHeaders1 = request1.headers(); const traceparentData1 = extractTraceparentData(requestHeaders1['sentry-trace']); expect(traceparentData1).toMatchObject({ - traceId: expect.stringMatching(/^([a-f0-9]{32})$/), - parentSpanId: expect.stringMatching(/^([a-f0-9]{16})$/), + traceId: expect.stringMatching(/^([a-f\d]{32})$/), + parentSpanId: expect.stringMatching(/^([a-f\d]{16})$/), parentSampled: true, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-relative-url/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-relative-url/test.ts index b1883896100c..0473f01e5015 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-relative-url/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-relative-url/test.ts @@ -23,7 +23,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p expect(span).toMatchObject({ description: `GET /test-req/${index}`, parent_span_id: tracingEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, @@ -57,14 +57,14 @@ sentryTest('should attach `sentry-trace` header to fetch requests', async ({ get const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -72,7 +72,7 @@ sentryTest('should attach `sentry-trace` header to fetch requests', async ({ get const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts index a0fea6e6af29..0ac0731d3537 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-strip-query-and-fragment/test.ts @@ -24,7 +24,7 @@ sentryTest('strips query params in fetch request spans', async ({ getLocalTestUr expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/0', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -67,7 +67,7 @@ sentryTest('strips hash fragment in fetch request spans', async ({ getLocalTestU expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/1', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -110,7 +110,7 @@ sentryTest('strips hash fragment and query params in fetch request spans', async expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/2', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -154,7 +154,7 @@ sentryTest( expect(requestSpan).toMatchObject({ description: 'GET /api/users', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled-propagateTraceparent/test.ts index 26815021f0e3..b8fd2b92ad01 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled-propagateTraceparent/test.ts @@ -18,8 +18,8 @@ sentryTest( const traceparentData = extractTraceparentData(requestHeaders['sentry-trace']); expect(traceparentData).toMatchObject({ - traceId: expect.stringMatching(/^([a-f0-9]{32})$/), - parentSpanId: expect.stringMatching(/^([a-f0-9]{16})$/), + traceId: expect.stringMatching(/^([a-f\d]{32})$/), + parentSpanId: expect.stringMatching(/^([a-f\d]{16})$/), parentSampled: false, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts index e1f69cb0fdf1..4d65cfcd78ea 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-unsampled/test.ts @@ -21,14 +21,14 @@ sentryTest('should attach `sentry-trace` header to unsampled fetch requests', as const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -36,7 +36,7 @@ sentryTest('should attach `sentry-trace` header to unsampled fetch requests', as const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance-propagateTraceparent/test.ts index 718cca0c8701..5ecb32caa07f 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance-propagateTraceparent/test.ts @@ -22,8 +22,8 @@ sentryTest( const traceparentData = extractTraceparentData(requestHeaders0['sentry-trace']); expect(traceparentData).toMatchObject({ - traceId: expect.stringMatching(/^([a-f0-9]{32})$/), - parentSpanId: expect.stringMatching(/^([a-f0-9]{16})$/), + traceId: expect.stringMatching(/^([a-f\d]{32})$/), + parentSpanId: expect.stringMatching(/^([a-f\d]{16})$/), parentSampled: undefined, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts index c2ebf52d18f6..c16c1d90ddda 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch-tracing-without-performance/test.ts @@ -23,14 +23,14 @@ sentryTest( const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -38,7 +38,7 @@ sentryTest( const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), }); }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts index 72a196d5d8e9..7955676bf0c8 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/fetch/test.ts @@ -26,7 +26,7 @@ sentryTest('should create spans for fetch requests', async ({ getLocalTestUrl, p expect(span).toMatchObject({ description: `GET http://sentry-test-site.example/${index}`, parent_span_id: tracingEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, @@ -62,7 +62,7 @@ sentryTest('attaches `sentry-trace` and `baggage` headers to fetch requests', as const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); // traceparent must only be attached if propagateTraceparent is `true` @@ -71,7 +71,7 @@ sentryTest('attaches `sentry-trace` and `baggage` headers to fetch requests', as const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -80,7 +80,7 @@ sentryTest('attaches `sentry-trace` and `baggage` headers to fetch requests', as const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); expect(requestHeaders3).not.toHaveProperty('traceparent'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-propagateTraceparent/test.ts index 1289dfb6cdcc..b97a6a70479b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-propagateTraceparent/test.ts @@ -25,8 +25,8 @@ sentryTest( const requestHeaders1 = request1.headers(); const traceparentData1 = extractTraceparentData(requestHeaders1['sentry-trace']); expect(traceparentData1).toMatchObject({ - traceId: expect.stringMatching(/^([a-f0-9]{32})$/), - parentSpanId: expect.stringMatching(/^([a-f0-9]{16})$/), + traceId: expect.stringMatching(/^([a-f\d]{32})$/), + parentSpanId: expect.stringMatching(/^([a-f\d]{16})$/), parentSampled: true, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-relative-url/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-relative-url/test.ts index ef180c0dcb6d..e207d3db04b2 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-relative-url/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-relative-url/test.ts @@ -23,7 +23,7 @@ sentryTest('should create spans for xhr requests', async ({ getLocalTestUrl, pag expect(span).toMatchObject({ description: `GET /test-req/${index}`, parent_span_id: tracingEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: tracingEvent.contexts?.trace?.trace_id, @@ -57,14 +57,14 @@ sentryTest('should attach `sentry-trace` header to xhr requests', async ({ getLo const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -72,7 +72,7 @@ sentryTest('should attach `sentry-trace` header to xhr requests', async ({ getLo const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts index d4ed06fcdd4e..fb96465b8b5b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-strip-query-and-fragment/test.ts @@ -24,7 +24,7 @@ sentryTest('strips query params in XHR request spans', async ({ getLocalTestUrl, expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/0', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -66,7 +66,7 @@ sentryTest('strips hash fragment in XHR request spans', async ({ getLocalTestUrl expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/1', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -108,7 +108,7 @@ sentryTest('strips hash fragment and query params in XHR request spans', async ( expect(requestSpan).toMatchObject({ description: 'GET http://sentry-test-site.example/2', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, @@ -151,7 +151,7 @@ sentryTest( expect(requestSpan).toMatchObject({ description: 'GET /api/users', parent_span_id: transactionEvent.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: transactionEvent.contexts?.trace?.trace_id, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts index 786ce872d349..ba4fd377fc1c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-unsampled/test.ts @@ -21,14 +21,14 @@ sentryTest('should attach `sentry-trace` header to unsampled xhr requests', asyn const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -36,7 +36,7 @@ sentryTest('should attach `sentry-trace` header to unsampled xhr requests', asyn const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/), baggage: expect.any(String), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance-propagateTraceparent/test.ts index de1afa51f962..23bf6e6ccac9 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance-propagateTraceparent/test.ts @@ -18,8 +18,8 @@ sentryTest( const traceparentData = extractTraceparentData(requestHeaders['sentry-trace']); expect(traceparentData).toEqual({ - traceId: expect.stringMatching(/^([a-f0-9]{32})$/), - parentSpanId: expect.stringMatching(/^([a-f0-9]{16})$/), + traceId: expect.stringMatching(/^([a-f\d]{32})$/), + parentSpanId: expect.stringMatching(/^([a-f\d]{16})$/), parentSampled: undefined, }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts index 728133a2ac4c..1806fcad21b5 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr-tracing-without-performance/test.ts @@ -23,14 +23,14 @@ sentryTest( const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -38,7 +38,7 @@ sentryTest( const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/), baggage: expect.any(String), }); }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts b/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts index cf3b11c02260..ccf40203281a 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/request/xhr/test.ts @@ -21,7 +21,7 @@ sentryTest('should create spans for XHR requests', async ({ getLocalTestUrl, pag expect(span).toMatchObject({ description: `GET http://sentry-test-site.example/${index}`, parent_span_id: eventData.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), trace_id: eventData.contexts?.trace?.trace_id, @@ -55,14 +55,14 @@ sentryTest('should attach `sentry-trace` header to XHR requests', async ({ getLo const request1 = requests[0]; const requestHeaders1 = request1.headers(); expect(requestHeaders1).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); const request2 = requests[1]; const requestHeaders2 = request2.headers(); expect(requestHeaders2).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), 'x-test-header': 'existing-header', }); @@ -70,7 +70,7 @@ sentryTest('should attach `sentry-trace` header to XHR requests', async ({ getLo const request3 = requests[2]; const requestHeaders3 = request3.headers(); expect(requestHeaders3).toMatchObject({ - 'sentry-trace': expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/), + 'sentry-trace': expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/), baggage: expect.any(String), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/default/test.ts b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/default/test.ts index 080ebbfa6e84..2019c78c837f 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/default/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/default/test.ts @@ -14,7 +14,7 @@ sentryTest('sets an inactive span active and adds child spans to it', async ({ g const checkoutEvent = envelopeRequestParser(await req); const checkoutSpanId = checkoutEvent.contexts?.trace?.span_id; - expect(checkoutSpanId).toMatch(/[a-f0-9]{16}/); + expect(checkoutSpanId).toMatch(/[a-f\d]{16}/); expect(checkoutEvent.spans).toHaveLength(3); diff --git a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested-parentAlwaysRoot/test.ts b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested-parentAlwaysRoot/test.ts index 2270b470123b..5132178d1981 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested-parentAlwaysRoot/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested-parentAlwaysRoot/test.ts @@ -21,8 +21,8 @@ sentryTest( const checkoutSpanId = checkoutEvent.contexts?.trace?.span_id; const postCheckoutSpanId = postCheckoutEvent.contexts?.trace?.span_id; - expect(checkoutSpanId).toMatch(/[a-f0-9]{16}/); - expect(postCheckoutSpanId).toMatch(/[a-f0-9]{16}/); + expect(checkoutSpanId).toMatch(/[a-f\d]{16}/); + expect(postCheckoutSpanId).toMatch(/[a-f\d]{16}/); expect(checkoutEvent.spans).toHaveLength(4); expect(postCheckoutEvent.spans).toHaveLength(1); diff --git a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested/test.ts b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested/test.ts index 094bb0ed3dd8..cea01f304691 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/setSpanActive/nested/test.ts @@ -21,8 +21,8 @@ sentryTest( const checkoutSpanId = checkoutEvent.contexts?.trace?.span_id; const postCheckoutSpanId = postCheckoutEvent.contexts?.trace?.span_id; - expect(checkoutSpanId).toMatch(/[a-f0-9]{16}/); - expect(postCheckoutSpanId).toMatch(/[a-f0-9]{16}/); + expect(checkoutSpanId).toMatch(/[a-f\d]{16}/); + expect(postCheckoutSpanId).toMatch(/[a-f\d]{16}/); expect(checkoutEvent.spans).toHaveLength(4); expect(postCheckoutEvent.spans).toHaveLength(1); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts index 42547709e928..0255507287d3 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/navigation/test.ts @@ -38,8 +38,8 @@ sentryTest('creates a new trace and sample_rand on each navigation', async ({ ge expect(navigation1TraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigation1TraceContext).not.toHaveProperty('parent_span_id'); @@ -54,8 +54,8 @@ sentryTest('creates a new trace and sample_rand on each navigation', async ({ ge expect(navigation2TraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigation2TraceContext).not.toHaveProperty('parent_span_id'); @@ -93,8 +93,8 @@ sentryTest('error after navigation has navigation traceId', async ({ getLocalTes expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -120,7 +120,7 @@ sentryTest('error after navigation has navigation traceId', async ({ getLocalTes const errorTraceContext = errorEvent.contexts?.trace; expect(errorTraceContext).toEqual({ trace_id: navigationTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ environment: 'production', @@ -162,8 +162,8 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc const navigationTraceContext = navigationEvent?.contexts?.trace; expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -179,7 +179,7 @@ sentryTest('error during navigation has new navigation traceId', async ({ getLoc const errorTraceContext = errorEvent?.contexts?.trace; expect(errorTraceContext).toEqual({ trace_id: navigationTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -230,8 +230,8 @@ sentryTest( expect(navigationEvent.type).toEqual('transaction'); expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -293,8 +293,8 @@ sentryTest( expect(navigationEvent.type).toEqual('transaction'); expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -335,8 +335,8 @@ sentryTest( const navigationTraceContext = navigationEvent.contexts?.trace; expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -357,7 +357,7 @@ sentryTest( expect(feedbackTraceContext).toMatchObject({ trace_id: navigationTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); }, ); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts index 98f468818d51..4269f91c2c07 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload-meta/test.ts @@ -43,7 +43,7 @@ sentryTest( op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceHeader).toEqual({ @@ -60,8 +60,8 @@ sentryTest( expect(navigationEvent.type).toEqual('transaction'); expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); // navigation span is head of trace, so there's no parent span: expect(navigationTraceContext?.trace_id).not.toHaveProperty('parent_span_id'); @@ -97,7 +97,7 @@ sentryTest('error after tag pageload has pageload traceId', async ({ getL op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceHeader).toEqual({ @@ -123,7 +123,7 @@ sentryTest('error after tag pageload has pageload traceId', async ({ getL expect(errorEvent.contexts?.trace).toEqual({ trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -165,7 +165,7 @@ sentryTest('error during tag pageload has pageload traceId', async ({ get op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceHeader).toEqual({ @@ -183,7 +183,7 @@ sentryTest('error during tag pageload has pageload traceId', async ({ get expect(errorEvent?.contexts?.trace).toEqual({ trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -230,7 +230,7 @@ sentryTest( op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceHeader).toEqual({ @@ -247,6 +247,7 @@ sentryTest( const headers = request.headers(); // sampling decision is propagated from meta tag's sentry-trace sampled flag + // eslint-disable-next-line regexp/prefer-d expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}-1$`)); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); }, @@ -284,7 +285,7 @@ sentryTest( op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceHeader).toEqual({ @@ -301,6 +302,7 @@ sentryTest( const headers = request.headers(); // sampling decision is propagated from meta tag's sentry-trace sampled flag + // eslint-disable-next-line regexp/prefer-d expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}-1$`)); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); }, @@ -320,7 +322,7 @@ sentryTest('user feedback event after pageload has pageload traceId in headers', op: 'pageload', trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); const feedbackEventPromise = getFirstSentryEnvelopeRequest(page); @@ -340,6 +342,6 @@ sentryTest('user feedback event after pageload has pageload traceId in headers', expect(feedbackTraceContext).toMatchObject({ trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts index e889be038bdd..e6edd02cf360 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/pageload/test.ts @@ -38,8 +38,8 @@ sentryTest( expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -54,8 +54,8 @@ sentryTest( expect(navigationTraceContext).toMatchObject({ op: 'navigation', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(navigationTraceContext).not.toHaveProperty('parent_span_id'); @@ -89,8 +89,8 @@ sentryTest('error after pageload has pageload traceId', async ({ getLocalTestUrl expect(pageloadEvent.type).toEqual('transaction'); expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -116,7 +116,7 @@ sentryTest('error after pageload has pageload traceId', async ({ getLocalTestUrl expect(errorTraceContext).toEqual({ trace_id: pageloadTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -156,8 +156,8 @@ sentryTest('error during pageload has pageload traceId', async ({ getLocalTestUr expect(pageloadEvent.type).toEqual('transaction'); expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -175,7 +175,7 @@ sentryTest('error during pageload has pageload traceId', async ({ getLocalTestUr expect(errorEvent.type).toEqual(undefined); expect(errorTraceContext).toEqual({ trace_id: pageloadTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -221,8 +221,8 @@ sentryTest( expect(pageloadEvent.type).toEqual('transaction'); expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -278,8 +278,8 @@ sentryTest( expect(pageloadEvent.type).toEqual('transaction'); expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -457,8 +457,8 @@ sentryTest('user feedback event after pageload has pageload traceId in headers', expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -479,6 +479,6 @@ sentryTest('user feedback event after pageload has pageload traceId in headers', expect(feedbackTraceContext).toMatchObject({ trace_id: pageloadTraceContext?.trace_id, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTrace/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTrace/test.ts index 6f5ede5eccf8..40cc8a64d75f 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTrace/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTrace/test.ts @@ -37,8 +37,8 @@ sentryTest( expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(pageloadTraceContext).not.toHaveProperty('parent_span_id'); @@ -71,8 +71,8 @@ sentryTest( const newTraceTransactionTraceContext = newTraceTransactionEvent.contexts?.trace; expect(newTraceTransactionTraceContext).toMatchObject({ op: 'ui.interaction.click', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(newTraceTransactionTraceHeaders).toEqual({ @@ -88,8 +88,8 @@ sentryTest( const oldTraceTransactionEventTraceContext = oldTraceTransactionEvent.contexts?.trace; expect(oldTraceTransactionEventTraceContext).toMatchObject({ op: 'ui.interaction.click', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(oldTraceTransactionTraceHeaders).toEqual({ diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTraceSampling/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTraceSampling/test.ts index 616c89cd66f8..dc3d75f54799 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTraceSampling/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/startNewTraceSampling/test.ts @@ -37,8 +37,8 @@ sentryTest( expect(pageloadTraceContext).toMatchObject({ op: 'pageload', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), data: { 'sentry.sample_rate': 0.5, }, @@ -67,8 +67,8 @@ sentryTest( const newTraceTransactionTraceContext = newTraceTransactionEvent.contexts?.trace; expect(newTraceTransactionTraceContext).toMatchObject({ op: 'ui.interaction.click', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), data: { 'sentry.sample_rate': 0.9, }, diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance-propagateTraceparent/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance-propagateTraceparent/test.ts index d2106b892b7b..95f4a23b533b 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance-propagateTraceparent/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance-propagateTraceparent/test.ts @@ -36,7 +36,7 @@ sentryTest( // sampling decision is deferred because TwP means we didn't sample any span expect(sentryTraceParentData).toEqual({ traceId: META_TAG_TRACE_ID, - parentSpanId: expect.stringMatching(/^[0-9a-f]{16}$/), + parentSpanId: expect.stringMatching(/^[\da-f]{16}$/), parentSampled: undefined, }); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); @@ -69,7 +69,7 @@ sentryTest( }); expect(headers3['baggage']).toMatch( - /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[0-9a-f]{32}/, + /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[\da-f]{32}/, ); expect(headers3['baggage']).not.toContain(`sentry-trace_id=${META_TAG_TRACE_ID}`); // but traceparent propagates a negative sampling decision because it has no concept of deferred sampling @@ -110,6 +110,8 @@ sentryTest('outgoing XHR requests have new traceId after navigation', async ({ g const headers = request.headers(); // sampling decision is deferred because TwP means we didn't sample any span + + // eslint-disable-next-line regexp/prefer-d expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}$`)); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); @@ -121,10 +123,10 @@ sentryTest('outgoing XHR requests have new traceId after navigation', async ({ g const headers2 = request2.headers(); // sampling decision is deferred because TwP means we didn't sample any span - expect(headers2['sentry-trace']).toMatch(/^[0-9a-f]{32}-[0-9a-f]{16}$/); + expect(headers2['sentry-trace']).toMatch(/^[\da-f]{32}-[\da-f]{16}$/); expect(headers2['baggage']).not.toBe(`${META_TAG_TRACE_ID}-${META_TAG_PARENT_SPAN_ID}`); expect(headers2['baggage']).toMatch( - /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[0-9a-f]{32}/, + /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[\da-f]{32}/, ); expect(headers2['baggage']).not.toContain(`sentry-trace_id=${META_TAG_TRACE_ID}`); }); diff --git a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts index 686f65227aa7..51cc61e0de0c 100644 --- a/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts +++ b/dev-packages/browser-integration-tests/suites/tracing/trace-lifetime/tracing-without-performance/test.ts @@ -33,7 +33,7 @@ sentryTest('error on initial page has traceId from meta tag', async ({ getLocalT expect(errorEvent.contexts?.trace).toEqual({ trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -65,7 +65,7 @@ sentryTest('error has new traceId after navigation', async ({ getLocalTestUrl, p expect(errorEvent.contexts?.trace).toEqual({ trace_id: META_TAG_TRACE_ID, parent_span_id: META_TAG_PARENT_SPAN_ID, - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader).toEqual({ @@ -85,8 +85,8 @@ sentryTest('error has new traceId after navigation', async ({ getLocalTestUrl, p const [errorEvent2, errorTraceHeader2] = await errorEventPromise2; expect(errorEvent2.contexts?.trace).toEqual({ - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), }); expect(errorTraceHeader2).toEqual({ @@ -121,6 +121,7 @@ sentryTest('outgoing fetch requests have new traceId after navigation', async ({ const headers = request.headers(); // sampling decision is deferred because TwP means we didn't sample any span + // eslint-disable-next-line regexp/prefer-d expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}$`)); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); @@ -132,10 +133,10 @@ sentryTest('outgoing fetch requests have new traceId after navigation', async ({ const headers2 = request2.headers(); // sampling decision is deferred because TwP means we didn't sample any span - expect(headers2['sentry-trace']).toMatch(/^[0-9a-f]{32}-[0-9a-f]{16}$/); + expect(headers2['sentry-trace']).toMatch(/^[\da-f]{32}-[\da-f]{16}$/); expect(headers2['baggage']).not.toBe(`${META_TAG_TRACE_ID}-${META_TAG_PARENT_SPAN_ID}`); expect(headers2['baggage']).toMatch( - /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[0-9a-f]{32}/, + /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[\da-f]{32}/, ); expect(headers2['baggage']).not.toContain(`sentry-trace_id=${META_TAG_TRACE_ID}`); }); @@ -163,6 +164,7 @@ sentryTest('outgoing XHR requests have new traceId after navigation', async ({ g const headers = request.headers(); // sampling decision is deferred because TwP means we didn't sample any span + // eslint-disable-next-line regexp/prefer-d expect(headers['sentry-trace']).toMatch(new RegExp(`^${META_TAG_TRACE_ID}-[0-9a-f]{16}$`)); expect(headers['baggage']).toBe(META_TAG_BAGGAGE); @@ -174,10 +176,10 @@ sentryTest('outgoing XHR requests have new traceId after navigation', async ({ g const headers2 = request2.headers(); // sampling decision is deferred because TwP means we didn't sample any span - expect(headers2['sentry-trace']).toMatch(/^[0-9a-f]{32}-[0-9a-f]{16}$/); + expect(headers2['sentry-trace']).toMatch(/^[\da-f]{32}-[\da-f]{16}$/); expect(headers2['baggage']).not.toBe(`${META_TAG_TRACE_ID}-${META_TAG_PARENT_SPAN_ID}`); expect(headers2['baggage']).toMatch( - /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[0-9a-f]{32}/, + /sentry-environment=production,sentry-public_key=public,sentry-trace_id=[\da-f]{32}/, ); expect(headers2['baggage']).not.toContain(`sentry-trace_id=${META_TAG_TRACE_ID}`); }); diff --git a/dev-packages/browser-integration-tests/utils/replayHelpers.ts b/dev-packages/browser-integration-tests/utils/replayHelpers.ts index 86a9e5ba3d78..72e98cb3e9d1 100644 --- a/dev-packages/browser-integration-tests/utils/replayHelpers.ts +++ b/dev-packages/browser-integration-tests/utils/replayHelpers.ts @@ -447,9 +447,10 @@ export function normalize( ): string { const rawString = JSON.stringify(obj, null, 2); let normalizedString = rawString - .replace(/"file:\/\/.+(\/.*\.html)"/gm, '"$1"') - .replace(/"timeOffset":\s*-?\d+/gm, '"timeOffset": [timeOffset]') - .replace(/"timestamp":\s*0/gm, '"timestamp": [timestamp]'); + // eslint-disable-next-line regexp/no-super-linear-backtracking + .replace(/"file:\/\/.+(\/.*\.html)"/g, '"$1"') + .replace(/"timeOffset":\s*-?\d+/g, '"timeOffset": [timeOffset]') + .replace(/"timestamp":\s*0/g, '"timestamp": [timestamp]'); if (normalizeNumberAttributes?.length) { // We look for: "attr": "123px", "123", "123%", "123em", "123rem" diff --git a/dev-packages/cloudflare-integration-tests/expect.ts b/dev-packages/cloudflare-integration-tests/expect.ts index 6050ff6816c4..5caec668cd13 100644 --- a/dev-packages/cloudflare-integration-tests/expect.ts +++ b/dev-packages/cloudflare-integration-tests/expect.ts @@ -2,11 +2,11 @@ import type { Contexts, Envelope, Event, SdkInfo } from '@sentry/core'; import { SDK_VERSION } from '@sentry/core'; import { expect } from 'vitest'; -export const UUID_MATCHER = expect.stringMatching(/^[0-9a-f]{32}$/); +export const UUID_MATCHER = expect.stringMatching(/^[\da-f]{32}$/); export const UUID_V4_MATCHER = expect.stringMatching( - /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/, + /^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/, ); -export const SHORT_UUID_MATCHER = expect.stringMatching(/^[0-9a-f]{16}$/); +export const SHORT_UUID_MATCHER = expect.stringMatching(/^[\da-f]{16}$/); export const ISO_DATE_MATCHER = expect.stringMatching(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/); function dropUndefinedKeys>(obj: T): T { diff --git a/dev-packages/node-core-integration-tests/suites/anr/test.ts b/dev-packages/node-core-integration-tests/suites/anr/test.ts index 08b6a6571e17..c9a81ccb5db0 100644 --- a/dev-packages/node-core-integration-tests/suites/anr/test.ts +++ b/dev-packages/node-core-integration-tests/suites/anr/test.ts @@ -6,8 +6,8 @@ const ANR_EVENT = { // Ensure we have context contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, device: { arch: expect.any(String), diff --git a/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts b/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts index c7d0ca5239fc..60edd2812b4b 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts @@ -16,8 +16,8 @@ test('cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts b/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts index fb3e7bacbf45..dcdb1ba4c4d9 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts @@ -16,8 +16,8 @@ test('node-cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('node-cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('node-cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('node-cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts b/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts index 285e41cee304..220f388d65d0 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts @@ -16,8 +16,8 @@ test('node-schedule instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('node-schedule instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('node-schedule instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('node-schedule instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-core-integration-tests/suites/tracing/dsc-txn-name-update/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/dsc-txn-name-update/test.ts index 9fe401badaa7..b9b2327497f5 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/dsc-txn-name-update/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/dsc-txn-name-update/test.ts @@ -16,13 +16,13 @@ conditionalTest({ min: 22 })('node >=22', () => { const baggageItems = getBaggageHeaderItems(headers); traceId = baggageItems.find(item => item.startsWith('sentry-trace_id='))?.split('=')[1] as string; - expect(traceId).toMatch(/^[0-9a-f]{32}$/); + expect(traceId).toMatch(/^[\da-f]{32}$/); expect(baggageItems).toEqual([ 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -33,7 +33,7 @@ conditionalTest({ min: 22 })('node >=22', () => { 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -45,7 +45,7 @@ conditionalTest({ min: 22 })('node >=22', () => { 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -77,7 +77,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), sample_rand: expect.any(String), }, }, @@ -90,7 +90,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-1', sample_rand: expect.any(String), }, @@ -104,7 +104,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-2', sample_rand: expect.any(String), }, @@ -118,7 +118,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-2', sample_rand: expect.any(String), }, diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts index bba04c788282..9fe5f34ef8e5 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts @@ -7,7 +7,7 @@ test('envelope header for error event during active unsampled span is correct', .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts index f11defc490c8..4b103c7e7d79 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts @@ -7,7 +7,7 @@ test('envelope header for error event during active span is correct', async () = .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error/test.ts index 9d39209d456f..29a487949adb 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/error/test.ts @@ -6,7 +6,7 @@ test('envelope header for error events is correct', async () => { .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'public', release: '1.0', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts index f4bb6e2b4293..9798194b0c1c 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event of route correct', async () => { .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', transaction: 'GET /route', environment: 'production', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts index c4ed5ae4983f..7b6b07191c44 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event with source=url correct', async () = .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction/test.ts index 104761d52c86..24276f57f212 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/envelope-header/transaction/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event is correct', async () => { .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-core-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts index 7c6612a0f4f7..d58f35b02972 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts @@ -13,8 +13,8 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() event: event => { const { contexts } = event; const { trace_id, span_id } = contexts?.trace || {}; - expect(trace_id).toMatch(/^[a-f0-9]{32}$/); - expect(span_id).toMatch(/^[a-f0-9]{16}$/); + expect(trace_id).toMatch(/^[a-f\d]{32}$/); + expect(span_id).toMatch(/^[a-f\d]{16}$/); const traceData = contexts?.traceData || {}; @@ -40,12 +40,12 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() event: event => { const { contexts } = event; const { trace_id, span_id } = contexts?.trace || {}; - expect(trace_id).toMatch(/^[a-f0-9]{32}$/); - expect(span_id).toMatch(/^[a-f0-9]{16}$/); + expect(trace_id).toMatch(/^[a-f\d]{32}$/); + expect(span_id).toMatch(/^[a-f\d]{16}$/); const traceData = contexts?.traceData || {}; - expect(traceData['sentry-trace']).toMatch(/^[a-f0-9]{32}-[a-f0-9]{16}$/); + expect(traceData['sentry-trace']).toMatch(/^[a-f\d]{32}-[a-f\d]{16}$/); expect(traceData['sentry-trace']).toContain(`${trace_id}-`); // span_id is a random span ID expect(traceData['sentry-trace']).not.toContain(span_id); @@ -53,7 +53,7 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() expect(traceData.baggage).toContain(`sentry-trace_id=${trace_id}`); expect(traceData.baggage).not.toContain('sentry-sampled='); - expect(traceData.metaTags).toMatch(//); + expect(traceData.metaTags).toMatch(//); expect(traceData.metaTags).toContain(`/); + expect(html).toMatch(//); expect(html).toContain(''); }); @@ -32,7 +32,7 @@ describe('getTraceMetaTags', () => { const html = response?.response; - const traceId = html?.match(//)?.[1]; + const traceId = html?.match(//)?.[1]; expect(traceId).not.toBeUndefined(); expect(html).toContain(' { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts index b4594c4d9c41..046763a0b55a 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts @@ -9,12 +9,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts index 32f24517b3f6..acc1d6c89a25 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts @@ -10,12 +10,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts index 097236ba4e7f..4507a360006c 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts @@ -10,12 +10,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts index fe9cba032344..1cad4abf9a99 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts @@ -11,12 +11,12 @@ describe('outgoing http requests with tracing & spans disabled', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing/test.ts index 8727f1cad0de..55882d18830a 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-no-tracing/test.ts @@ -11,12 +11,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts index d89992dd362e..8cf07571fe24 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts @@ -12,12 +12,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled/test.ts index 1189afc502e5..a1ac7ca292e4 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-sampled/test.ts @@ -12,12 +12,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-unsampled/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-unsampled/test.ts index 60d3345dcb51..63ae25f32a0c 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/requests/http-unsampled/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/requests/http-unsampled/test.ts @@ -12,12 +12,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/suites/tracing/sample-rand-propagation/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/sample-rand-propagation/test.ts index 40001a9f62f5..6bb8f3dfc3f6 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/sample-rand-propagation/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/sample-rand-propagation/test.ts @@ -30,7 +30,7 @@ describe('sample_rand propagation', () => { }); expect(response).toEqual({ propagatedData: { - baggage: expect.not.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + baggage: expect.not.stringMatching(/sentry-sample_rand=0\.\d+/), }, }); }); @@ -44,7 +44,7 @@ describe('sample_rand propagation', () => { }, }); - const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.[0-9]+)/)[1]); + const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.\d+)/)[1]); expect(sampleRand).toStrictEqual(expect.any(Number)); expect(sampleRand).not.toBeNaN(); @@ -61,7 +61,7 @@ describe('sample_rand propagation', () => { }, }); - const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.[0-9]+)/)[1]); + const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.\d+)/)[1]); expect(sampleRand).toStrictEqual(expect.any(Number)); expect(sampleRand).not.toBeNaN(); @@ -77,6 +77,6 @@ describe('sample_rand propagation', () => { }, }); - expect((response as any).propagatedData.baggage).not.toMatch(/sentry-sample_rand=0\.[0-9]+/); + expect((response as any).propagatedData.baggage).not.toMatch(/sentry-sample_rand=0\.\d+/); }); }); diff --git a/dev-packages/node-core-integration-tests/suites/tracing/tracePropagationTargets/test.ts b/dev-packages/node-core-integration-tests/suites/tracing/tracePropagationTargets/test.ts index 8ae06f883b38..a136eb770a8d 100644 --- a/dev-packages/node-core-integration-tests/suites/tracing/tracePropagationTargets/test.ts +++ b/dev-packages/node-core-integration-tests/suites/tracing/tracePropagationTargets/test.ts @@ -12,12 +12,12 @@ conditionalTest({ min: 22 })('node >=22', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-core-integration-tests/utils/runner.ts b/dev-packages/node-core-integration-tests/utils/runner.ts index 22a600efa63b..416d55d803a1 100644 --- a/dev-packages/node-core-integration-tests/utils/runner.ts +++ b/dev-packages/node-core-integration-tests/utils/runner.ts @@ -489,7 +489,7 @@ export function createRunner(...paths: string[]) { function tryParseEnvelopeFromStdoutLine(line: string): void { // Lines can have leading '[something] [{' which we need to remove - const cleanedLine = line.replace(/^.*?] \[{"/, '[{"'); + const cleanedLine = line.replace(/^.*?\] \[\{"/, '[{"'); // See if we have a port message if (cleanedLine.startsWith('{"port":')) { @@ -676,6 +676,7 @@ function convertEsmToCjs(content: string): string { // Handle default imports: import x from 'y' -> const x = require('y') newContent = newContent.replace( + // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation /import\s+([\w*{}\s,]+)\s+from\s+['"]([^'"]+)['"]/g, (_, imports: string, module: string) => { if (imports.includes('* as')) { diff --git a/dev-packages/node-integration-tests/suites/anr/test.ts b/dev-packages/node-integration-tests/suites/anr/test.ts index 08b6a6571e17..c9a81ccb5db0 100644 --- a/dev-packages/node-integration-tests/suites/anr/test.ts +++ b/dev-packages/node-integration-tests/suites/anr/test.ts @@ -6,8 +6,8 @@ const ANR_EVENT = { // Ensure we have context contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, device: { arch: expect.any(String), diff --git a/dev-packages/node-integration-tests/suites/cron/cron/test.ts b/dev-packages/node-integration-tests/suites/cron/cron/test.ts index 8b9fdfd5c593..a9febf9efbe4 100644 --- a/dev-packages/node-integration-tests/suites/cron/cron/test.ts +++ b/dev-packages/node-integration-tests/suites/cron/cron/test.ts @@ -16,8 +16,8 @@ test('cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-integration-tests/suites/cron/node-cron/test.ts b/dev-packages/node-integration-tests/suites/cron/node-cron/test.ts index 1c5fa515e208..a986e3f83d92 100644 --- a/dev-packages/node-integration-tests/suites/cron/node-cron/test.ts +++ b/dev-packages/node-integration-tests/suites/cron/node-cron/test.ts @@ -16,8 +16,8 @@ test('node-cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('node-cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('node-cron instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('node-cron instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-integration-tests/suites/cron/node-schedule/test.ts b/dev-packages/node-integration-tests/suites/cron/node-schedule/test.ts index a2019253203f..2b46e04d50a4 100644 --- a/dev-packages/node-integration-tests/suites/cron/node-schedule/test.ts +++ b/dev-packages/node-integration-tests/suites/cron/node-schedule/test.ts @@ -16,8 +16,8 @@ test('node-schedule instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -31,8 +31,8 @@ test('node-schedule instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -46,8 +46,8 @@ test('node-schedule instrumentation', async () => { monitor_config: { schedule: { type: 'crontab', value: '* * * * * *' } }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, @@ -61,8 +61,8 @@ test('node-schedule instrumentation', async () => { duration: expect.any(Number), contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, }, }, diff --git a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-assign/test.ts b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-assign/test.ts index 8b8d648513e4..20f19dccf3ea 100644 --- a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-assign/test.ts +++ b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-assign/test.ts @@ -113,8 +113,8 @@ test('Should populate and propagate sentry baggage if sentry-trace header does n 'sentry-release': '1.0', 'sentry-public_key': 'public', // TraceId changes, hence we only expect that the string contains the traceid key - 'sentry-trace_id': expect.stringMatching(/[\S]*/), - 'sentry-sample_rand': expect.stringMatching(/[\S]*/), + 'sentry-trace_id': expect.stringMatching(/\S*/), + 'sentry-sample_rand': expect.stringMatching(/\S*/), 'sentry-sample_rate': '1', 'sentry-sampled': 'true', 'sentry-transaction': 'GET /test/express', @@ -139,8 +139,8 @@ test('Should populate Sentry and ignore 3rd party content if sentry-trace header 'sentry-release': '1.0', 'sentry-public_key': 'public', // TraceId changes, hence we only expect that the string contains the traceid key - 'sentry-trace_id': expect.stringMatching(/[\S]*/), - 'sentry-sample_rand': expect.stringMatching(/[\S]*/), + 'sentry-trace_id': expect.stringMatching(/\S*/), + 'sentry-sample_rand': expect.stringMatching(/\S*/), 'sentry-sample_rate': '1', 'sentry-sampled': 'true', 'sentry-transaction': 'GET /test/express', diff --git a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts index 913fcd5e2038..4551baa06e23 100644 --- a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts +++ b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-header-out/test.ts @@ -23,7 +23,7 @@ test('should attach a baggage header to an outgoing request.', async () => { 'sentry-sampled=true', 'sentry-trace_id=__SENTRY_TRACE_ID__', 'sentry-transaction=GET%20%2Ftest%2Fexpress', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), ].forEach(item => { expect(baggage).toContainEqual(item); }); diff --git a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-other-vendors-with-sentry-entries/test.ts b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-other-vendors-with-sentry-entries/test.ts index 2d2074be773c..dbdd69ffb45b 100644 --- a/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-other-vendors-with-sentry-entries/test.ts +++ b/dev-packages/node-integration-tests/suites/express/sentry-trace/baggage-other-vendors-with-sentry-entries/test.ts @@ -32,7 +32,7 @@ test('should ignore sentry-values in `baggage` header of a third party vendor an 'other=vendor', 'sentry-environment=myEnv', 'sentry-release=2.1.0', - expect.stringMatching(/sentry-sample_rand=[0-9]+/), + expect.stringMatching(/sentry-sample_rand=\d+/), 'sentry-sample_rate=0.54', 'third=party', ]); @@ -60,10 +60,10 @@ test('should ignore sentry-values in `baggage` header of a third party vendor an 'sentry-environment=prod', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=[0-9]+/), + expect.stringMatching(/sentry-sample_rand=\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', - expect.stringMatching(/sentry-trace_id=[0-9a-f]{32}/), + expect.stringMatching(/sentry-trace_id=[\da-f]{32}/), 'sentry-transaction=GET%20%2Ftest%2Fexpress', 'third=party', ]); diff --git a/dev-packages/node-integration-tests/suites/express/tracing/test.ts b/dev-packages/node-integration-tests/suites/express/tracing/test.ts index 4476c76a3933..9cff4678f038 100644 --- a/dev-packages/node-integration-tests/suites/express/tracing/test.ts +++ b/dev-packages/node-integration-tests/suites/express/tracing/test.ts @@ -14,8 +14,8 @@ describe('express tracing', () => { transaction: { contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { url: expect.stringMatching(/\/test\/express$/), 'http.response.status_code': 200, @@ -61,8 +61,8 @@ describe('express tracing', () => { }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), data: { url: expect.stringMatching(/\/test\/regex$/), 'http.response.status_code': 200, @@ -85,8 +85,8 @@ describe('express tracing', () => { transaction: 'GET /', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, url: expect.stringMatching(/\/$/), @@ -132,8 +132,8 @@ describe('express tracing', () => { }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), data: { url: expect.stringMatching(`/test/${segment}$`), 'http.response.status_code': 200, @@ -169,8 +169,8 @@ describe('express tracing', () => { }, contexts: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), data: { url: expect.stringMatching(`/test/${segment}$`), 'http.response.status_code': 200, @@ -346,8 +346,8 @@ describe('express tracing', () => { transaction: `GET ${url}`, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': status_code, url: expect.stringMatching(url), diff --git a/dev-packages/node-integration-tests/suites/featureFlags/growthbook/onSpan/test.ts b/dev-packages/node-integration-tests/suites/featureFlags/growthbook/onSpan/test.ts index fbb084b98928..3f0011b4f617 100644 --- a/dev-packages/node-integration-tests/suites/featureFlags/growthbook/onSpan/test.ts +++ b/dev-packages/node-integration-tests/suites/featureFlags/growthbook/onSpan/test.ts @@ -20,8 +20,8 @@ test('GrowthBook flags are added to active span attributes on span end', async ( op: 'function', origin: 'manual', status: 'ok', - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, }, spans: [], diff --git a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts index f450d2150e31..aa74bea7d79e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/dsc-txn-name-update/test.ts @@ -12,13 +12,13 @@ test('adds current transaction name to baggage when the txn name is high-quality const baggageItems = getBaggageHeaderItems(headers); traceId = baggageItems.find(item => item.startsWith('sentry-trace_id='))?.split('=')[1] as string; - expect(traceId).toMatch(/^[0-9a-f]{32}$/); + expect(traceId).toMatch(/^[\da-f]{32}$/); expect(baggageItems).toEqual([ 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -29,7 +29,7 @@ test('adds current transaction name to baggage when the txn name is high-quality 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -41,7 +41,7 @@ test('adds current transaction name to baggage when the txn name is high-quality 'sentry-environment=production', 'sentry-public_key=public', 'sentry-release=1.0', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), 'sentry-sample_rate=1', 'sentry-sampled=true', `sentry-trace_id=${traceId}`, @@ -72,7 +72,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), sample_rand: expect.any(String), }, }, @@ -85,7 +85,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-1', sample_rand: expect.any(String), }, @@ -99,7 +99,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-2', sample_rand: expect.any(String), }, @@ -113,7 +113,7 @@ test('adds current transaction name to trace envelope header when the txn name i release: '1.0', sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'updated-name-2', sample_rand: expect.any(String), }, diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts index bba04c788282..9fe5f34ef8e5 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span-unsampled/test.ts @@ -7,7 +7,7 @@ test('envelope header for error event during active unsampled span is correct', .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts index f11defc490c8..4b103c7e7d79 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error-active-span/test.ts @@ -7,7 +7,7 @@ test('envelope header for error event during active span is correct', async () = .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error/test.ts index 9d39209d456f..29a487949adb 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/error/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/error/test.ts @@ -6,7 +6,7 @@ test('envelope header for error events is correct', async () => { .expectHeader({ event: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'public', release: '1.0', diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts index f4bb6e2b4293..9798194b0c1c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-route/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event of route correct', async () => { .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', transaction: 'GET /route', environment: 'production', diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts index c4ed5ae4983f..7b6b07191c44 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction-url/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event with source=url correct', async () = .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction/test.ts b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction/test.ts index 104761d52c86..24276f57f212 100644 --- a/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/envelope-header/transaction/test.ts @@ -6,7 +6,7 @@ test('envelope header for transaction event is correct', async () => { .expectHeader({ transaction: { trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), public_key: 'public', environment: 'production', release: '1.0', diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts index 797047080283..580a63a52e90 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-strip-query/test.ts @@ -44,7 +44,7 @@ test('strips and handles query params in spans of outgoing fetch requests', asyn origin: 'auto.http.otel.node_fetch', status: 'ok', parent_span_id: txn.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: txn.contexts?.trace?.trace_id, }); }, diff --git a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts index ebe2eff07013..edfac9fe2081 100644 --- a/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/http-client-spans/http-strip-query/test.ts @@ -44,7 +44,7 @@ test('strips and handles query params in spans of outgoing http requests', async origin: 'auto.http.otel.http', status: 'ok', parent_span_id: txn.contexts?.trace?.span_id, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: txn.contexts?.trace?.trace_id, }); }, diff --git a/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts b/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts index 48fab1be2e9d..15c354e45533 100644 --- a/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/httpIntegration/test.ts @@ -27,8 +27,8 @@ describe('httpIntegration', () => { transaction: { contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { url: expect.stringMatching(/\/test$/), 'http.response.status_code': 200, @@ -69,8 +69,8 @@ describe('httpIntegration', () => { transaction: { contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { url: expect.stringMatching(/\/test$/), 'http.response.status_code': 200, @@ -198,8 +198,8 @@ describe('httpIntegration', () => { transaction: 'GET /test1', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -214,8 +214,8 @@ describe('httpIntegration', () => { transaction: 'GET /test2', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -230,8 +230,8 @@ describe('httpIntegration', () => { transaction: 'GET /test3', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -256,8 +256,8 @@ describe('httpIntegration', () => { transaction: 'GET /test1-proxy', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -272,8 +272,8 @@ describe('httpIntegration', () => { transaction: 'GET /test2-proxy', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -288,8 +288,8 @@ describe('httpIntegration', () => { transaction: 'GET /test3-proxy', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -313,8 +313,8 @@ describe('httpIntegration', () => { transaction: 'GET /test1-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -329,8 +329,8 @@ describe('httpIntegration', () => { transaction: 'GET /test2-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -345,8 +345,8 @@ describe('httpIntegration', () => { transaction: 'GET /test3-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -371,8 +371,8 @@ describe('httpIntegration', () => { transaction: 'GET /test1-proxy-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -387,8 +387,8 @@ describe('httpIntegration', () => { transaction: 'GET /test2-proxy-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -403,8 +403,8 @@ describe('httpIntegration', () => { transaction: 'GET /test3-proxy-original', contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'http.response.status_code': 200, 'sentry.op': 'http.server', @@ -433,8 +433,8 @@ describe('httpIntegration', () => { transaction: { contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { url: expect.stringMatching(/\/test$/), 'http.response.status_code': 200, @@ -459,8 +459,8 @@ describe('httpIntegration', () => { transaction: { contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { url: expect.stringMatching(/\/test$/), 'http.response.status_code': 200, diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts index 7c6612a0f4f7..d58f35b02972 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags-twp-errors/test.ts @@ -13,8 +13,8 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() event: event => { const { contexts } = event; const { trace_id, span_id } = contexts?.trace || {}; - expect(trace_id).toMatch(/^[a-f0-9]{32}$/); - expect(span_id).toMatch(/^[a-f0-9]{16}$/); + expect(trace_id).toMatch(/^[a-f\d]{32}$/); + expect(span_id).toMatch(/^[a-f\d]{16}$/); const traceData = contexts?.traceData || {}; @@ -40,12 +40,12 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() event: event => { const { contexts } = event; const { trace_id, span_id } = contexts?.trace || {}; - expect(trace_id).toMatch(/^[a-f0-9]{32}$/); - expect(span_id).toMatch(/^[a-f0-9]{16}$/); + expect(trace_id).toMatch(/^[a-f\d]{32}$/); + expect(span_id).toMatch(/^[a-f\d]{16}$/); const traceData = contexts?.traceData || {}; - expect(traceData['sentry-trace']).toMatch(/^[a-f0-9]{32}-[a-f0-9]{16}$/); + expect(traceData['sentry-trace']).toMatch(/^[a-f\d]{32}-[a-f\d]{16}$/); expect(traceData['sentry-trace']).toContain(`${trace_id}-`); // span_id is a random span ID expect(traceData['sentry-trace']).not.toContain(span_id); @@ -53,7 +53,7 @@ describe('errors in TwP mode have same trace in trace context and getTraceData() expect(traceData.baggage).toContain(`sentry-trace_id=${trace_id}`); expect(traceData.baggage).not.toContain('sentry-sampled='); - expect(traceData.metaTags).toMatch(//); + expect(traceData.metaTags).toMatch(//); expect(traceData.metaTags).toContain(`/) || [ + const [, traceId, spanId] = html.match(//) || [ undefined, undefined, undefined, diff --git a/dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts b/dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts index c1b88699d8a0..a8d88fdd7cb4 100644 --- a/dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/meta-tags/test.ts @@ -21,7 +21,7 @@ describe('getTraceMetaTags', () => { const html = response?.response; - expect(html).toMatch(//); + expect(html).toMatch(//); expect(html).toContain(''); }); @@ -32,7 +32,7 @@ describe('getTraceMetaTags', () => { const html = response?.response; - const traceId = html?.match(//)?.[1]; + const traceId = html?.match(//)?.[1]; expect(traceId).not.toBeUndefined(); expect(html).toContain(' { const html = response?.response; - const traceId = html?.match(//)?.[1]; + const traceId = html?.match(//)?.[1]; expect(traceId).not.toBeUndefined(); expect(html).toContain(' { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts index b4594c4d9c41..046763a0b55a 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-no-tracing/test.ts @@ -9,12 +9,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts index 32f24517b3f6..acc1d6c89a25 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-sampled-no-active-span/test.ts @@ -10,12 +10,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts index 097236ba4e7f..4507a360006c 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/fetch-unsampled/test.ts @@ -10,12 +10,12 @@ describe('outgoing fetch', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts index fe9cba032344..1cad4abf9a99 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing-no-spans/test.ts @@ -11,12 +11,12 @@ describe('outgoing http requests with tracing & spans disabled', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing/test.ts index 7922fe3a443f..d0b13513d1de 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-no-tracing/test.ts @@ -9,12 +9,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) .get('/api/v1', headers => { - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); expect(headers['baggage']).toEqual(expect.any(String)); }) diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts index 8d1afff8c867..932f379ec23e 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled-no-active-span/test.ts @@ -10,12 +10,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled/test.ts index 5951db7f51b7..9a7b13a34332 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-sampled/test.ts @@ -10,12 +10,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/suites/tracing/requests/http-unsampled/test.ts b/dev-packages/node-integration-tests/suites/tracing/requests/http-unsampled/test.ts index 4e83d2e3feb1..28fb877d0425 100644 --- a/dev-packages/node-integration-tests/suites/tracing/requests/http-unsampled/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/requests/http-unsampled/test.ts @@ -10,12 +10,12 @@ describe('outgoing http', () => { const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-0$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-0$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-0'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/suites/tracing/sample-rand-propagation/test.ts b/dev-packages/node-integration-tests/suites/tracing/sample-rand-propagation/test.ts index df25a261ab2c..a63efe51adbd 100644 --- a/dev-packages/node-integration-tests/suites/tracing/sample-rand-propagation/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/sample-rand-propagation/test.ts @@ -11,7 +11,7 @@ describe('sample_rand propagation', () => { const response = await runner.makeRequest('get', '/check'); expect(response).toEqual({ propagatedData: { - baggage: expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + baggage: expect.stringMatching(/sentry-sample_rand=0\.\d+/), }, }); }); @@ -40,7 +40,7 @@ describe('sample_rand propagation', () => { }); expect(response).toEqual({ propagatedData: { - baggage: expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + baggage: expect.stringMatching(/sentry-sample_rand=0\.\d+/), }, }); }); @@ -54,7 +54,7 @@ describe('sample_rand propagation', () => { }, }); - const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.[0-9]+)/)[1]); + const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.\d+)/)[1]); expect(sampleRand).toStrictEqual(expect.any(Number)); expect(sampleRand).not.toBeNaN(); @@ -71,7 +71,7 @@ describe('sample_rand propagation', () => { }, }); - const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.[0-9]+)/)[1]); + const sampleRand = Number((response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.\d+)/)[1]); expect(sampleRand).toStrictEqual(expect.any(Number)); expect(sampleRand).not.toBeNaN(); @@ -87,8 +87,8 @@ describe('sample_rand propagation', () => { }, }); - expect((response as any).propagatedData.baggage).toMatch(/sentry-sample_rand=0\.[0-9]+/); - const sampleRandStr = (response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.[0-9]+)/)[1]; + expect((response as any).propagatedData.baggage).toMatch(/sentry-sample_rand=0\.\d+/); + const sampleRandStr = (response as any).propagatedData.baggage.match(/sentry-sample_rand=(0\.\d+)/)[1]; expect(sampleRandStr).not.toBe('0.5'); }); }); diff --git a/dev-packages/node-integration-tests/suites/tracing/tracePropagationTargets/test.ts b/dev-packages/node-integration-tests/suites/tracing/tracePropagationTargets/test.ts index 4185dec46afb..9fb39a1ec8f2 100644 --- a/dev-packages/node-integration-tests/suites/tracing/tracePropagationTargets/test.ts +++ b/dev-packages/node-integration-tests/suites/tracing/tracePropagationTargets/test.ts @@ -8,12 +8,12 @@ test('HttpIntegration should instrument correct requests when tracePropagationTa const [SERVER_URL, closeTestServer] = await createTestServer() .get('/api/v0', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v1', headers => { expect(headers['baggage']).toEqual(expect.any(String)); - expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f0-9]{32})-([a-f0-9]{16})-1$/)); + expect(headers['sentry-trace']).toEqual(expect.stringMatching(/^([a-f\d]{32})-([a-f\d]{16})-1$/)); expect(headers['sentry-trace']).not.toEqual('00000000000000000000000000000000-0000000000000000-1'); }) .get('/api/v2', headers => { diff --git a/dev-packages/node-integration-tests/utils/runner.ts b/dev-packages/node-integration-tests/utils/runner.ts index ac15a944ee0b..35a84a3d4d2f 100644 --- a/dev-packages/node-integration-tests/utils/runner.ts +++ b/dev-packages/node-integration-tests/utils/runner.ts @@ -611,7 +611,7 @@ export function createRunner(...paths: string[]) { function tryParseEnvelopeFromStdoutLine(line: string): void { // Lines can have leading '[something] [{' which we need to remove - const cleanedLine = line.replace(/^.*?] \[{"/, '[{"'); + const cleanedLine = line.replace(/^.*?\] \[\{"/, '[{"'); // See if we have a port message if (cleanedLine.startsWith('{"port":')) { @@ -801,6 +801,7 @@ function convertEsmToCjs(content: string): string { // Handle default imports: import x from 'y' -> const x = require('y') newContent = newContent.replace( + // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/optimal-quantifier-concatenation /import\s+([\w*{}\s,]+)\s+from\s+['"]([^'"]+)['"]/g, (_, imports: string, module: string) => { if (imports.includes('* as')) { diff --git a/packages/browser/src/integrations/graphqlClient.ts b/packages/browser/src/integrations/graphqlClient.ts index a467a4a70ff4..65e385c1fb71 100644 --- a/packages/browser/src/integrations/graphqlClient.ts +++ b/packages/browser/src/integrations/graphqlClient.ts @@ -144,8 +144,8 @@ export function getRequestPayloadXhrOrFetch(hint: XhrHint | FetchHint): string | * Exported for tests only. */ export function parseGraphQLQuery(query: string): GraphQLOperation { - const namedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/; - const unnamedQueryRe = /^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/; + const namedQueryRe = /^\s*(query|mutation|subscription)\s*(\w+)\s*[{(]/; + const unnamedQueryRe = /^\s*(query|mutation|subscription)\s*[{(]/; const namedMatch = query.match(namedQueryRe); if (namedMatch) { diff --git a/packages/browser/src/profiling/utils.ts b/packages/browser/src/profiling/utils.ts index ed794a40a98b..95952cd59563 100644 --- a/packages/browser/src/profiling/utils.ts +++ b/packages/browser/src/profiling/utils.ts @@ -264,7 +264,7 @@ export function validateProfileChunk(chunk: ProfileChunk): { valid: true } | { r } // profiler_id and chunk_id must be 32 lowercase hex chars - const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f0-9]{32}$/.test(val); + const isHex32 = (val: unknown): boolean => typeof val === 'string' && /^[a-f\d]{32}$/.test(val); if (!isHex32(chunk.profiler_id)) { return { reason: 'missing or invalid profiler_id' }; } diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index 02c3a1f66af3..1402fccecf2c 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -53,13 +53,14 @@ function createFrame(filename: string, func: string, lineno?: number, colno?: nu // This regex matches frames that have no function name (ie. are at the top level of a module). // For example "at http://localhost:5000//script.js:1:126" // Frames _with_ function names usually look as follows: "at commitLayoutEffects (react-dom.development.js:23426:1)" -const chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i; +const chromeRegexNoFnName = /^\s*at (\S+?):(\d+):(\d+)\s*$/i; // This regex matches all the frames that have a function name. const chromeRegex = + // eslint-disable-next-line regexp/no-super-linear-backtracking /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i; -const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/; +const chromeEvalRegex = /\((\S*):(\d+):(\d+)\)/; // Matches stack frames with data URIs instead of filename so we can still get the function name // Example: "at dynamicFn (data:application/javascript,export function dynamicFn() {..." @@ -117,7 +118,8 @@ export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chromeSt // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js // We need this specific case for now because we want no other regex to match. const geckoREgex = - /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; + // eslint-disable-next-line regexp/no-super-linear-backtracking,regexp/no-unused-capturing-group,regexp/no-optional-assertion + /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?([-a-z]*:\/.*?|\[native code\]|[^@]*(?:bundle|\d\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i; const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i; const gecko: StackLineParserFn = line => { @@ -149,7 +151,7 @@ const gecko: StackLineParserFn = line => { export const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko]; -const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i; +const winjsRegex = /^\s*at (?:(.+) )?\(?([-a-z]+:.*?):(\d+)(?::(\d+))?\)?\s*$/i; const winjs: StackLineParserFn = line => { const parts = winjsRegex.exec(line) as null | [string, string, string, string, string]; @@ -161,7 +163,7 @@ const winjs: StackLineParserFn = line => { export const winjsStackLineParser: StackLineParser = [WINJS_PRIORITY, winjs]; -const opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; +const opera10Regex = / line (\d).*script (?:in )?(\S+)(?:: in function (\S+))?$/i; const opera10: StackLineParserFn = line => { const parts = opera10Regex.exec(line) as null | [string, string, string, string]; @@ -171,6 +173,7 @@ const opera10: StackLineParserFn = line => { export const opera10StackLineParser: StackLineParser = [OPERA10_PRIORITY, opera10]; const opera11Regex = + // eslint-disable-next-line regexp/no-super-linear-backtracking / line (\d+), column (\d+)\s*(?:in (?:]+)>|([^)]+))\(.*\))? in (.*):\s*$/i; const opera11: StackLineParserFn = line => { diff --git a/packages/browser/test/tracing/browserTracingIntegration.test.ts b/packages/browser/test/tracing/browserTracingIntegration.test.ts index e3f1060655c2..02bb499964fd 100644 --- a/packages/browser/test/tracing/browserTracingIntegration.test.ts +++ b/packages/browser/test/tracing/browserTracingIntegration.test.ts @@ -107,9 +107,9 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); @@ -178,9 +178,9 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'url', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // this is what is used to get the span name - JSDOM does not update this on it's own! @@ -217,9 +217,9 @@ describe('browserTracingIntegration', () => { trace_id: span?.spanContext().traceId, }, ], - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // this is what is used to get the span name - JSDOM does not update this on it's own! @@ -255,9 +255,9 @@ describe('browserTracingIntegration', () => { trace_id: span2?.spanContext().traceId, }, ], - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); @@ -315,9 +315,9 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); expect(spanIsSampled(span!)).toBe(true); }); @@ -352,9 +352,9 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', testy: 'yes', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); @@ -544,7 +544,7 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'manual', [SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE]: 1, [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', - [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: expect.stringMatching(/[a-f0-9]{32}-[a-f0-9]{16}-1/), + [PREVIOUS_TRACE_TMP_SPAN_ATTRIBUTE]: expect.stringMatching(/[a-f\d]{32}-[a-f\d]{16}-1/), }, links: [ { @@ -552,13 +552,13 @@ describe('browserTracingIntegration', () => { 'sentry.link.type': 'previous_trace', }, sampled: true, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, ], - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); expect(spanIsSampled(span!)).toBe(true); }); @@ -599,9 +599,9 @@ describe('browserTracingIntegration', () => { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'custom', testy: 'yes', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); @@ -722,22 +722,22 @@ describe('browserTracingIntegration', () => { const newCurrentScopePropCtx = getCurrentScope().getPropagationContext(); expect(oldCurrentScopePropCtx).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), - propagationSpanId: expect.stringMatching(/[a-f0-9]{16}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), + propagationSpanId: expect.stringMatching(/[a-f\d]{16}/), sampleRand: expect.any(Number), }); expect(oldIsolationScopePropCtx).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), sampleRand: expect.any(Number), }); expect(newCurrentScopePropCtx).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), - propagationSpanId: expect.stringMatching(/[a-f0-9]{16}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), + propagationSpanId: expect.stringMatching(/[a-f\d]{16}/), sampleRand: expect.any(Number), }); expect(newIsolationScopePropCtx).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), - propagationSpanId: expect.stringMatching(/[a-f0-9]{16}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), + propagationSpanId: expect.stringMatching(/[a-f\d]{16}/), sampleRand: expect.any(Number), }); @@ -764,7 +764,7 @@ describe('browserTracingIntegration', () => { const propCtxBeforeEnd = getCurrentScope().getPropagationContext(); expect(propCtxBeforeEnd).toEqual({ sampleRand: expect.any(Number), - traceId: expect.stringMatching(/[a-f0-9]{32}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), }); navigationSpan!.end(); @@ -805,7 +805,7 @@ describe('browserTracingIntegration', () => { const propCtxBeforeEnd = getCurrentScope().getPropagationContext(); expect(propCtxBeforeEnd).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), sampleRand: expect.any(Number), }); diff --git a/packages/cloudflare/src/workflows.ts b/packages/cloudflare/src/workflows.ts index 17ec17e9cd85..647aa0712e31 100644 --- a/packages/cloudflare/src/workflows.ts +++ b/packages/cloudflare/src/workflows.ts @@ -24,7 +24,7 @@ import { addCloudResourceContext } from './scope-utils'; import { init } from './sdk'; import { copyExecutionContext } from './utils/copyExecutionContext'; -const UUID_REGEX = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i; +const UUID_REGEX = /^[\da-f]{8}-?[\da-f]{4}-?[\da-f]{4}-?[\da-f]{4}-?[\da-f]{12}$/i; /** * Hashes a string to a UUID using SHA-1. diff --git a/packages/cloudflare/test/handler.test.ts b/packages/cloudflare/test/handler.test.ts index 7768689ffc48..ed2a2c851b63 100644 --- a/packages/cloudflare/test/handler.test.ts +++ b/packages/cloudflare/test/handler.test.ts @@ -368,8 +368,8 @@ describe('withSentry', () => { }, op: 'faas.cron', origin: 'auto.faas.cloudflare.scheduled', - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); }); @@ -607,8 +607,8 @@ describe('withSentry', () => { }, op: 'faas.email', origin: 'auto.faas.cloudflare.email', - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); }); @@ -850,8 +850,8 @@ describe('withSentry', () => { }, op: 'queue.process', origin: 'auto.faas.cloudflare.queue', - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); }); diff --git a/packages/cloudflare/test/request.test.ts b/packages/cloudflare/test/request.test.ts index d6d0de5824a1..9f6f9c343504 100644 --- a/packages/cloudflare/test/request.test.ts +++ b/packages/cloudflare/test/request.test.ts @@ -271,7 +271,7 @@ describe('withSentry', () => { ); expect(sentryEvent.contexts?.trace).toEqual({ parent_span_id: '1121201211212012', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: '12312012123120121231201212312012', }); }); @@ -323,9 +323,9 @@ describe('withSentry', () => { }, op: 'http.server', origin: 'auto.http.cloudflare', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), parent_span_id: undefined, links: undefined, }); diff --git a/packages/cloudflare/test/workflow.test.ts b/packages/cloudflare/test/workflow.test.ts index fa922d7233e0..51819951adc6 100644 --- a/packages/cloudflare/test/workflow.test.ts +++ b/packages/cloudflare/test/workflow.test.ts @@ -72,7 +72,7 @@ describe.skipIf(NODE_MAJOR_VERSION < 20)('workflows', () => { }); test('hashStringToUuid hashes a string to a UUID for Sentry trace ID', async () => { - const UUID_WITHOUT_HYPHENS_REGEX = /^[0-9a-f]{32}$/i; + const UUID_WITHOUT_HYPHENS_REGEX = /^[\da-f]{32}$/i; expect(await deterministicTraceIdFromInstanceId('s')).toMatch(UUID_WITHOUT_HYPHENS_REGEX); expect(await deterministicTraceIdFromInstanceId('test-string')).toMatch(UUID_WITHOUT_HYPHENS_REGEX); expect(await deterministicTraceIdFromInstanceId(INSTANCE_ID)).toMatch(UUID_WITHOUT_HYPHENS_REGEX); diff --git a/packages/core/src/utils/dsn.ts b/packages/core/src/utils/dsn.ts index 492f2398c390..561468b793cc 100644 --- a/packages/core/src/utils/dsn.ts +++ b/packages/core/src/utils/dsn.ts @@ -7,7 +7,7 @@ import { consoleSandbox, debug } from './debug-logger'; const ORG_ID_REGEX = /^o(\d+)\./; /** Regular expression used to parse a Dsn. */ -const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/; +const DSN_REGEX = /^(\w+):\/\/(\w+)(?::(\w+)?)?@([\w.-]+)(?::(\d+))?\/(.+)/; function isValidProtocol(protocol?: string): protocol is DsnProtocol { return protocol === 'http' || protocol === 'https'; diff --git a/packages/core/src/utils/isSentryRequestUrl.ts b/packages/core/src/utils/isSentryRequestUrl.ts index 8cda9404164a..09b882355911 100644 --- a/packages/core/src/utils/isSentryRequestUrl.ts +++ b/packages/core/src/utils/isSentryRequestUrl.ts @@ -32,7 +32,7 @@ function checkDsn(url: string, dsn: DsnComponents | undefined): boolean { return false; } - return dsn ? urlParts.host.includes(dsn.host) && /(^|&|\?)sentry_key=/.test(urlParts.search) : false; + return dsn ? urlParts.host.includes(dsn.host) && /(?:^|&|\?)sentry_key=/.test(urlParts.search) : false; } function removeTrailingSlash(str: string): string { diff --git a/packages/core/src/utils/misc.ts b/packages/core/src/utils/misc.ts index 69cd217345b8..6f8f173a9660 100644 --- a/packages/core/src/utils/misc.ts +++ b/packages/core/src/utils/misc.ts @@ -122,7 +122,7 @@ export function addExceptionMechanism(event: Event, newMechanism?: Partial { expect(TestClient.instance?.event?.contexts?.trace).toEqual({ parent_span_id: undefined, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); diff --git a/packages/core/test/lib/envelope.test.ts b/packages/core/test/lib/envelope.test.ts index c5d246973842..d601614642c0 100644 --- a/packages/core/test/lib/envelope.test.ts +++ b/packages/core/test/lib/envelope.test.ts @@ -128,11 +128,11 @@ describe('createSpanEnvelope', () => { description: 'test', is_segment: true, origin: 'manual', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), segment_id: spanItem?.segment_id, start_timestamp: 1, timestamp: 2, - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), }); }); @@ -148,7 +148,7 @@ describe('createSpanEnvelope', () => { environment: 'production', public_key: 'username', sampled: 'false', - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), transaction: 'test', }, }); @@ -218,11 +218,11 @@ describe('createSpanEnvelope', () => { description: 'test', is_segment: true, origin: 'manual', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), segment_id: spanItem?.segment_id, start_timestamp: 1, timestamp: 2, - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), }); }); @@ -253,11 +253,11 @@ describe('createSpanEnvelope', () => { description: 'mutated description: test', is_segment: true, origin: 'manual', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), segment_id: spanItem?.segment_id, start_timestamp: 1, timestamp: 2, - trace_id: expect.stringMatching(/^[0-9a-f]{32}$/), + trace_id: expect.stringMatching(/^[\da-f]{32}$/), }); }); }); diff --git a/packages/core/test/lib/feedback.test.ts b/packages/core/test/lib/feedback.test.ts index 306424853354..c876aac799c7 100644 --- a/packages/core/test/lib/feedback.test.ts +++ b/packages/core/test/lib/feedback.test.ts @@ -53,7 +53,7 @@ describe('captureFeedback', () => { trace: { environment: 'production', public_key: 'dsn', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, }, [ @@ -63,8 +63,8 @@ describe('captureFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { message: 'test', @@ -113,7 +113,7 @@ describe('captureFeedback', () => { trace: { environment: 'production', public_key: 'dsn', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, }, [ @@ -123,8 +123,8 @@ describe('captureFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { name: 'doe', @@ -195,7 +195,7 @@ describe('captureFeedback', () => { trace: { environment: 'production', public_key: 'dsn', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, }, [ @@ -205,8 +205,8 @@ describe('captureFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { message: 'test', @@ -293,7 +293,7 @@ describe('captureFeedback', () => { trace: { trace_id: traceId, parent_span_id: spanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), }, feedback: { message: 'test', @@ -421,7 +421,7 @@ describe('captureFeedback', () => { event_id: expect.any(String), sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', }, @@ -433,8 +433,8 @@ describe('captureFeedback', () => { breadcrumbs: [{ message: 'test breadcrumb', timestamp: 12345 }], contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { contact_email: 're@example.org', diff --git a/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts b/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts index 65fcf5a71c8e..c831d7fabfc3 100644 --- a/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts +++ b/packages/core/test/lib/tracing/dynamicSamplingContext.test.ts @@ -78,7 +78,7 @@ describe('getDynamicSamplingContextFromSpan', () => { environment: 'production', sampled: 'true', sample_rate: '0.56', - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), transaction: 'tx', sample_rand: expect.any(String), }); @@ -98,7 +98,7 @@ describe('getDynamicSamplingContextFromSpan', () => { environment: 'production', sampled: 'true', sample_rate: '1', - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), transaction: 'tx', sample_rand: expect.any(String), }); @@ -123,7 +123,7 @@ describe('getDynamicSamplingContextFromSpan', () => { environment: 'production', sampled: 'true', sample_rate: '0.56', - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), transaction: 'tx', sample_rand: undefined, // this is a bit funky admittedly }); @@ -178,7 +178,7 @@ describe('getDynamicSamplingContextFromSpan', () => { org_id: undefined, release: '1.0.1', environment: 'production', - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), transaction: 'tx', }); }); diff --git a/packages/core/test/lib/tracing/idleSpan.test.ts b/packages/core/test/lib/tracing/idleSpan.test.ts index 3e930872945d..4fe6bc70115f 100644 --- a/packages/core/test/lib/tracing/idleSpan.test.ts +++ b/packages/core/test/lib/tracing/idleSpan.test.ts @@ -68,7 +68,7 @@ describe('startIdleSpan', () => { public_key: '123', sample_rate: '0', sampled: 'false', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); // not set as active span, though diff --git a/packages/core/test/lib/tracing/sentryNonRecordingSpan.test.ts b/packages/core/test/lib/tracing/sentryNonRecordingSpan.test.ts index 25d8100518d3..9beb0393f1a7 100644 --- a/packages/core/test/lib/tracing/sentryNonRecordingSpan.test.ts +++ b/packages/core/test/lib/tracing/sentryNonRecordingSpan.test.ts @@ -17,8 +17,8 @@ describe('SentryNonRecordingSpan', () => { expect(spanIsSampled(span)).toBe(false); expect(span.isRecording()).toBe(false); expect(spanToJSON(span)).toEqual({ - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: {}, start_timestamp: 0, }); @@ -33,8 +33,8 @@ describe('SentryNonRecordingSpan', () => { // but nothing is actually set/readable expect(spanToJSON(span)).toEqual({ - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: {}, start_timestamp: 0, }); diff --git a/packages/core/test/lib/tracing/sentrySpan.test.ts b/packages/core/test/lib/tracing/sentrySpan.test.ts index 4b70e1c3ef97..9f5b1d99583c 100644 --- a/packages/core/test/lib/tracing/sentrySpan.test.ts +++ b/packages/core/test/lib/tracing/sentrySpan.test.ts @@ -221,8 +221,8 @@ describe('SentrySpan', () => { 'sentry.origin': 'manual', }, origin: 'manual', - span_id: expect.stringMatching(/^[a-f0-9]{16}$/), - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + span_id: expect.stringMatching(/^[a-f\d]{16}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), }, }, sdkProcessingMetadata: { @@ -231,7 +231,7 @@ describe('SentrySpan', () => { dynamicSamplingContext: { environment: 'production', public_key: 'username', - trace_id: expect.stringMatching(/^[a-f0-9]{32}$/), + trace_id: expect.stringMatching(/^[a-f\d]{32}$/), transaction: 'test', }, }, diff --git a/packages/core/test/lib/tracing/trace.test.ts b/packages/core/test/lib/tracing/trace.test.ts index a1d786dfdd10..249be5e292a8 100644 --- a/packages/core/test/lib/tracing/trace.test.ts +++ b/packages/core/test/lib/tracing/trace.test.ts @@ -200,11 +200,11 @@ describe('startSpan', () => { }, origin: 'auto.http.browser', description: 'GET users/[id]', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: isError ? 'internal_error' : undefined, timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }); }); }); @@ -225,7 +225,7 @@ describe('startSpan', () => { environment: 'production', sample_rate: '0', sampled: 'false', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'GET users/[id]', }); }); @@ -496,8 +496,8 @@ describe('startSpan', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }); @@ -521,7 +521,7 @@ describe('startSpan', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', }, @@ -799,7 +799,7 @@ describe('startSpan', () => { const spanJson = spanToJSON(span); expect(spanJson.is_segment).toBe(true); expect(spanJson.segment_id).toBe(spanJson.span_id); - expect(spanJson.segment_id).toMatch(/^[a-f0-9]{16}$/); + expect(spanJson.segment_id).toMatch(/^[a-f\d]{16}$/); }); it.each([undefined, false])("doesn't set segment properties if standalone is falsy (%s)", standalone => { @@ -852,7 +852,7 @@ describe('startSpanManual', () => { environment: 'production', sample_rate: '0', sampled: 'false', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'GET users/[id]', }); }); @@ -1100,8 +1100,8 @@ describe('startSpanManual', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }); @@ -1125,7 +1125,7 @@ describe('startSpanManual', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', }, @@ -1346,7 +1346,7 @@ describe('startInactiveSpan', () => { environment: 'production', sample_rate: '0', sampled: 'false', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'GET users/[id]', }); }); @@ -1508,8 +1508,8 @@ describe('startInactiveSpan', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }); @@ -1533,7 +1533,7 @@ describe('startInactiveSpan', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', }, @@ -2311,7 +2311,7 @@ describe('startNewTrace', () => { startNewTrace(() => { const newCurrentScopeItraceId = getCurrentScope().getPropagationContext().traceId; - expect(newCurrentScopeItraceId).toMatch(/^[a-f0-9]{32}$/); + expect(newCurrentScopeItraceId).toMatch(/^[a-f\d]{32}$/); expect(newCurrentScopeItraceId).not.toEqual(oldCurrentScopeItraceId); }); }); @@ -2322,7 +2322,7 @@ describe('startNewTrace', () => { startNewTrace(() => { const newIsolationScopeTraceId = getIsolationScope().getPropagationContext().traceId; - expect(newIsolationScopeTraceId).toMatch(/^[a-f0-9]{32}$/); + expect(newIsolationScopeTraceId).toMatch(/^[a-f\d]{32}$/); expect(newIsolationScopeTraceId).toEqual(oldIsolationScopeTraceId); }); }); diff --git a/packages/core/test/lib/utils/envelope.test.ts b/packages/core/test/lib/utils/envelope.test.ts index 85bff6a662f2..8f5f510633bb 100644 --- a/packages/core/test/lib/utils/envelope.test.ts +++ b/packages/core/test/lib/utils/envelope.test.ts @@ -65,10 +65,10 @@ describe('envelope', () => { }, description: expect.any(String), op: expect.any(String), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: expect.any(String), exclusive_time: expect.any(Number), measurements: { inp: { value: expect.any(Number), unit: expect.any(String) } }, diff --git a/packages/core/test/lib/utils/misc.test.ts b/packages/core/test/lib/utils/misc.test.ts index 885e2dc64b8d..cb54a29eb74a 100644 --- a/packages/core/test/lib/utils/misc.test.ts +++ b/packages/core/test/lib/utils/misc.test.ts @@ -291,7 +291,7 @@ describe('checkOrSetAlreadyCaught()', () => { }); describe('uuid4 generation', () => { - const uuid4Regex = /^[0-9A-F]{12}[4][0-9A-F]{3}[89AB][0-9A-F]{15}$/i; + const uuid4Regex = /^[\dA-F]{12}4[\dA-F]{3}[89AB][\dA-F]{15}$/i; it('returns valid and unique uuid v4 ids via Math.random', () => { const uuids = new Set(); for (let index = 0; index < 1_000; index++) { diff --git a/packages/core/test/lib/utils/spanUtils.test.ts b/packages/core/test/lib/utils/spanUtils.test.ts index bca9a406dd50..b16da8335ae5 100644 --- a/packages/core/test/lib/utils/spanUtils.test.ts +++ b/packages/core/test/lib/utils/spanUtils.test.ts @@ -141,7 +141,7 @@ describe('spanToTraceContext', () => { expect(spanToTraceContext(span)).toEqual({ parent_span_id: '1234', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), trace_id: 'ABCD', }); }); @@ -156,7 +156,7 @@ describe('spanToTraceContext', () => { expect(spanToTraceContext(span)).toEqual({ parent_span_id: '1234', - span_id: expect.stringMatching(/^[0-9a-f]{16}$/), + span_id: expect.stringMatching(/^[\da-f]{16}$/), trace_id: 'ABCD', }); }); diff --git a/packages/core/test/lib/utils/string.test.ts b/packages/core/test/lib/utils/string.test.ts index b3d166568163..edb0204f3e92 100644 --- a/packages/core/test/lib/utils/string.test.ts +++ b/packages/core/test/lib/utils/string.test.ts @@ -47,7 +47,7 @@ describe('isMatchingPattern()', () => { test('match using regexp test', () => { expect(isMatchingPattern('foobar', /^foo/)).toEqual(true); expect(isMatchingPattern('foobar', /foo/)).toEqual(true); - expect(isMatchingPattern('foobar', /b.{1}r/)).toEqual(true); + expect(isMatchingPattern('foobar', /b.r/)).toEqual(true); expect(isMatchingPattern('foobar', /^foo$/)).toEqual(false); }); @@ -92,7 +92,7 @@ describe('stringMatchesSomePattern()', () => { test('match using regexp test', () => { expect(stringMatchesSomePattern('foobar', [/^foo/, 'nope'])).toEqual(true); expect(stringMatchesSomePattern('foobar', [/foo/, 'nope'])).toEqual(true); - expect(stringMatchesSomePattern('foobar', [/b.{1}r/, 'nope'])).toEqual(true); + expect(stringMatchesSomePattern('foobar', [/b.r/, 'nope'])).toEqual(true); expect(stringMatchesSomePattern('foobar', [/^foo$/, 'nope'])).toEqual(false); }); diff --git a/packages/core/test/lib/utils/traceData.test.ts b/packages/core/test/lib/utils/traceData.test.ts index 379103a8a48c..69a0e06191fc 100644 --- a/packages/core/test/lib/utils/traceData.test.ts +++ b/packages/core/test/lib/utils/traceData.test.ts @@ -182,7 +182,7 @@ describe('getTraceData', () => { const traceData = getTraceData({ client: customClient, scope }); - expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f0-9]{16}$/); + expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f\d]{16}$/); expect(traceData.baggage).toEqual( 'sentry-environment=production,sentry-public_key=567,sentry-trace_id=12345678901234567890123456789012', ); @@ -206,7 +206,7 @@ describe('getTraceData', () => { const traceData = getTraceData(); - expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f0-9]{16}-1$/); + expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f\d]{16}-1$/); expect(traceData.baggage).toEqual( 'sentry-environment=staging,sentry-public_key=key,sentry-trace_id=12345678901234567890123456789012,sentry-sample_rand=0.42', ); @@ -345,6 +345,6 @@ describe('getTraceData', () => { const traceData = getTraceData({ propagateTraceparent: true }); expect(traceData.traceparent).toBeDefined(); - expect(traceData.traceparent).toMatch(/00-12345678901234567890123456789099-[0-9a-f]{16}-00/); + expect(traceData.traceparent).toMatch(/00-12345678901234567890123456789099-[\da-f]{16}-00/); }); }); diff --git a/packages/eslint-config-sdk/package.json b/packages/eslint-config-sdk/package.json index eb1ec1b22117..c050aa7bd60d 100644 --- a/packages/eslint-config-sdk/package.json +++ b/packages/eslint-config-sdk/package.json @@ -30,6 +30,7 @@ "eslint-plugin-deprecation": "^1.5.0", "eslint-plugin-import": "^2.22.0", "eslint-plugin-jsdoc": "^30.0.3", + "eslint-plugin-regexp": "^1.15.0", "eslint-plugin-simple-import-sort": "^6.0.0" }, "peerDependencies": { diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index 5b77056bfbb2..a28833ff6da1 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -19,8 +19,8 @@ module.exports = { { // Configuration for typescript files files: ['*.ts', '*.tsx', '*.d.ts'], - extends: ['plugin:@typescript-eslint/recommended', 'plugin:deprecation/recommended'], - plugins: ['@typescript-eslint', 'jsdoc'], + extends: ['plugin:@typescript-eslint/recommended', 'plugin:deprecation/recommended', 'plugin:regexp/recommended'], + plugins: ['@typescript-eslint', 'jsdoc', 'regexp'], parser: '@typescript-eslint/parser', rules: { // We want to guard against using the equality operator with empty arrays diff --git a/packages/feedback/test/core/sendFeedback.test.ts b/packages/feedback/test/core/sendFeedback.test.ts index a0cbb084da59..9c1c703bdd9a 100644 --- a/packages/feedback/test/core/sendFeedback.test.ts +++ b/packages/feedback/test/core/sendFeedback.test.ts @@ -52,7 +52,7 @@ describe('sendFeedback', () => { event_id: expect.any(String), sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', }, @@ -64,8 +64,8 @@ describe('sendFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { message: 'mi', @@ -108,7 +108,7 @@ describe('sendFeedback', () => { event_id: expect.any(String), sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', }, @@ -120,8 +120,8 @@ describe('sendFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { name: 'doe', @@ -160,7 +160,7 @@ describe('sendFeedback', () => { event_id: expect.any(String), sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', sample_rate: '1', @@ -176,8 +176,8 @@ describe('sendFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { contact_email: 're@example.org', @@ -225,7 +225,7 @@ describe('sendFeedback', () => { event_id: expect.any(String), sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', }, @@ -237,8 +237,8 @@ describe('sendFeedback', () => { breadcrumbs: [{ message: 'test breadcrumb', timestamp: 12345 }], contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { contact_email: 're@example.org', @@ -395,7 +395,7 @@ describe('sendFeedback', () => { event_id: eventId, sent_at: expect.any(String), trace: { - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), environment: 'production', public_key: 'dsn', }, @@ -407,8 +407,8 @@ describe('sendFeedback', () => { breadcrumbs: undefined, contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, feedback: { contact_email: 're@example.org', diff --git a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts index ef3fc5383522..3903aa968b42 100644 --- a/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts +++ b/packages/google-cloud-serverless/src/integrations/google-cloud-http.ts @@ -70,5 +70,5 @@ function wrapRequestFunction(orig: RequestFunction): RequestFunction { /** Identifies service by its base url */ function identifyService(apiEndpoint: string): string { const match = apiEndpoint.match(/^https:\/\/(\w+)\.googleapis.com$/); - return match?.[1] || apiEndpoint.replace(/^(http|https)?:\/\//, ''); + return match?.[1] || apiEndpoint.replace(/^(?:http|https)?:\/\//, ''); } diff --git a/packages/nextjs/src/client/clientNormalizationIntegration.ts b/packages/nextjs/src/client/clientNormalizationIntegration.ts index c92147c82bbe..3c69c0ffbdcf 100644 --- a/packages/nextjs/src/client/clientNormalizationIntegration.ts +++ b/packages/nextjs/src/client/clientNormalizationIntegration.ts @@ -61,7 +61,7 @@ export const nextjsClientStackFrameNormalizationIntegration = defineIntegration( if ( frame.filename?.match( - /\/_next\/static\/chunks\/(main-|main-app-|polyfills-|webpack-|framework-|framework\.)[0-9a-f]+\.js$/, + /\/_next\/static\/chunks\/(?:main-|main-app-|polyfills-|webpack-|framework-|framework\.)[\da-f]+\.js$/, ) ) { // We don't care about these frames. It's Next.js internal code. @@ -74,7 +74,7 @@ export const nextjsClientStackFrameNormalizationIntegration = defineIntegration( if ( frame.filename?.match( - /^app:\/\/\/_next\/static\/chunks\/(main-|main-app-|polyfills-|webpack-|framework-|framework\.)[0-9a-f]+\.js$/, + /^app:\/\/\/_next\/static\/chunks\/(?:main-|main-app-|polyfills-|webpack-|framework-|framework\.)[\da-f]+\.js$/, ) ) { // We don't care about these frames. It's Next.js internal code. diff --git a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts index e9317709f4e7..7c46b8df54e0 100644 --- a/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts +++ b/packages/nextjs/src/client/routing/pagesRouterRoutingInstrumentation.ts @@ -115,7 +115,7 @@ export function pagesRouterInstrumentPageLoad(client: Client): void { if (parsedBaggage?.['sentry-transaction'] && name === '/_error') { name = parsedBaggage['sentry-transaction']; // Strip any HTTP method from the span name - name = name.replace(/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|TRACE|CONNECT)\s+/i, ''); + name = name.replace(/^(?:GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS|TRACE|CONNECT)\s+/i, ''); } const origin = browserPerformanceTimeOrigin(); diff --git a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts index 9ae0a5ee0bb2..74dfd7b107ec 100644 --- a/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts +++ b/packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts @@ -247,7 +247,7 @@ function parseOriginalCodeFrame(codeFrame: string): { // Remove ASCII control characters that are used for syntax highlighting .replace( // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, // https://stackoverflow.com/a/29497680 + /[\u001b\u009b][[()#;?]*(?:\d{1,4}(?:;\d{0,4})*)?[\dA-ORZcf-nqry=><]/g, // https://stackoverflow.com/a/29497680 '', ) .split('\n') @@ -300,7 +300,8 @@ function stripWebpackInternalPrefix(filename: string): string | undefined { return filename; } - const webpackInternalRegex = /^webpack-internal:(?:\/+)?(?:\([^)]*\)\/)?(.+)$/; + // eslint-disable-next-line regexp/no-super-linear-backtracking + const webpackInternalRegex = /^webpack-internal:\/*(?:\([^)]*\)\/)?(.+)$/; const match = filename.match(webpackInternalRegex); return match ? match[1] : filename; diff --git a/packages/nextjs/src/config/loaders/valueInjectionLoader.ts b/packages/nextjs/src/config/loaders/valueInjectionLoader.ts index c15413cd1444..847d94a06557 100644 --- a/packages/nextjs/src/config/loaders/valueInjectionLoader.ts +++ b/packages/nextjs/src/config/loaders/valueInjectionLoader.ts @@ -1,5 +1,4 @@ // Rollup doesn't like if we put the directive regex as a literal (?). No idea why. -/* eslint-disable @sentry-internal/sdk/no-regexp-constructor */ import type { LoaderThis } from './types'; @@ -12,7 +11,8 @@ export type ValueInjectionLoaderOptions = { // This regex is shamelessly stolen from: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/7f984482c73e4284e8b12a08dfedf23b5a82f0af/packages/bundler-plugin-core/src/index.ts#L535-L539 const SKIP_COMMENT_AND_DIRECTIVE_REGEX = // Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files. - new RegExp('^(?:\\s*|/\\*(?:.|\\r|\\n)*?\\*/|//.*[\\n\\r])*(?:"[^"]*";?|\'[^\']*\';?)?'); + // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor,prefer-regex-literals + new RegExp('^(?:\\s|/\\*(?:.|[\\r\\n])*?\\*/|//.*[\\n\\r])*(?:"[^"]*";?|\'[^\']*\';?)?'); /** * Set values on the global/window object at the start of a module. diff --git a/packages/nextjs/src/config/loaders/wrappingLoader.ts b/packages/nextjs/src/config/loaders/wrappingLoader.ts index 3125102e9656..f9face582fec 100644 --- a/packages/nextjs/src/config/loaders/wrappingLoader.ts +++ b/packages/nextjs/src/config/loaders/wrappingLoader.ts @@ -129,7 +129,7 @@ export default function wrappingLoader( // Add a slash at the beginning .replace(/(.*)/, '/$1') // Pull off the file name - .replace(/\/[^/]+\.(js|ts|jsx|tsx)$/, '') + .replace(/\/[^/]+\.(?:js|ts|jsx|tsx)$/, '') // In case all of the above have left us with an empty string (which will happen if we're dealing with the // homepage), sub back in the root route .replace(/^$/, '/'); diff --git a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts index 9691cce74782..b84fc817b081 100644 --- a/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/distDirRewriteFramesIntegration.ts @@ -1,7 +1,7 @@ import { defineIntegration, escapeStringForRegex, rewriteFramesIntegration } from '@sentry/core'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { - const distDirAbsPath = distDirName.replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one + const distDirAbsPath = distDirName.replace(/(?:\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one // Normally we would use `path.resolve` to obtain the absolute path we will strip from the stack frame to align with // the uploaded artifacts, however we don't have access to that API in edge so we need to be a bit more lax. diff --git a/packages/nextjs/src/edge/rewriteFramesIntegration.ts b/packages/nextjs/src/edge/rewriteFramesIntegration.ts index 8681009ef1f8..decb1a6e441d 100644 --- a/packages/nextjs/src/edge/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/edge/rewriteFramesIntegration.ts @@ -22,7 +22,7 @@ export const customRewriteFramesIntegration = ((options?: RewriteFramesOptions) const distDirName = process.env._sentryRewriteFramesDistDir || globalWithInjectedValues._sentryRewriteFramesDistDir; if (distDirName) { - const distDirAbsPath = distDirName.replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one + const distDirAbsPath = distDirName.replace(/(?:\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one // Normally we would use `path.resolve` to obtain the absolute path we will strip from the stack frame to align with // the uploaded artifacts, however we don't have access to that API in edge so we need to be a bit more lax. diff --git a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts index dd4a3cdc7beb..a7c1efa69ae3 100644 --- a/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/distDirRewriteFramesIntegration.ts @@ -4,7 +4,7 @@ import * as path from 'path'; export const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }: { distDirName: string }) => { // nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so // we can read in the project directory from the currently running process - const distDirAbsPath = path.resolve(distDirName).replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one + const distDirAbsPath = path.resolve(distDirName).replace(/(?:\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- user input is escaped const SOURCEMAP_FILENAME_REGEX = new RegExp(escapeStringForRegex(distDirAbsPath)); diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index aa6210c2ff6a..4d0ebd270bf4 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -230,7 +230,7 @@ export function init(options: NodeOptions): NodeClient | undefined { // Filter out transactions for static assets // This regex matches the default path to the static assets (`_next/static`) and could potentially filter out too many transactions. // We match `/_next/static/` anywhere in the transaction name because its location may change with the basePath setting. - if (event.transaction?.match(/^GET (\/.*)?\/_next\/static\//)) { + if (event.transaction?.match(/^GET (?:\/.*)?\/_next\/static\//)) { return null; } diff --git a/packages/nextjs/src/server/rewriteFramesIntegration.ts b/packages/nextjs/src/server/rewriteFramesIntegration.ts index 9433920015c8..4696201e839b 100644 --- a/packages/nextjs/src/server/rewriteFramesIntegration.ts +++ b/packages/nextjs/src/server/rewriteFramesIntegration.ts @@ -25,7 +25,7 @@ export const customRewriteFramesIntegration = ((options?: RewriteFramesOptions) if (distDirName) { // nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so // we can read in the project directory from the currently running process - const distDirAbsPath = path.resolve(distDirName).replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one + const distDirAbsPath = path.resolve(distDirName).replace(/(?:\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- user input is escaped const SOURCEMAP_FILENAME_REGEX = new RegExp(escapeStringForRegex(distDirAbsPath)); diff --git a/packages/nextjs/test/utils/tunnelRoute.test.ts b/packages/nextjs/test/utils/tunnelRoute.test.ts index 8382e66ca7d4..2ed0f63012d2 100644 --- a/packages/nextjs/test/utils/tunnelRoute.test.ts +++ b/packages/nextjs/test/utils/tunnelRoute.test.ts @@ -92,7 +92,7 @@ describe('Random tunnel route generation', () => { applyTunnelRouteOption(options); expect(options.tunnel).toBe('/abc123def?o=2222222&p=3333333'); - expect(options.tunnel).toMatch(/^\/[a-z0-9]+\?o=2222222&p=3333333$/); + expect(options.tunnel).toMatch(/^\/[a-z\d]+\?o=2222222&p=3333333$/); }); it('Works with region DSNs when tunnelRoute is true', () => { @@ -104,7 +104,7 @@ describe('Random tunnel route generation', () => { applyTunnelRouteOption(options); expect(options.tunnel).toBe('/x7h9k2m?o=2222222&p=3333333&r=eu'); - expect(options.tunnel).toMatch(/^\/[a-z0-9]+\?o=2222222&p=3333333&r=eu$/); + expect(options.tunnel).toMatch(/^\/[a-z\d]+\?o=2222222&p=3333333&r=eu$/); }); it('Does not apply tunnel when tunnelRoute is false', () => { diff --git a/packages/node-core/src/integrations/context.ts b/packages/node-core/src/integrations/context.ts index cad8a1c4a443..f029d026206d 100644 --- a/packages/node-core/src/integrations/context.ts +++ b/packages/node-core/src/integrations/context.ts @@ -346,9 +346,9 @@ async function getDarwinInfo(): Promise { }); }); - darwinInfo.name = matchFirst(/^ProductName:\s+(.*)$/m, output); - darwinInfo.version = matchFirst(/^ProductVersion:\s+(.*)$/m, output); - darwinInfo.build = matchFirst(/^BuildVersion:\s+(.*)$/m, output); + darwinInfo.name = matchFirst(/^ProductName:\s+(\S.*)$/m, output); + darwinInfo.version = matchFirst(/^ProductVersion:\s+(\S.*)$/m, output); + darwinInfo.build = matchFirst(/^BuildVersion:\s+(\S.*)$/m, output); } catch { // ignore } diff --git a/packages/node-core/src/integrations/http/httpServerSpansIntegration.ts b/packages/node-core/src/integrations/http/httpServerSpansIntegration.ts index c24c0c68d1da..d99873d32e55 100644 --- a/packages/node-core/src/integrations/http/httpServerSpansIntegration.ts +++ b/packages/node-core/src/integrations/http/httpServerSpansIntegration.ts @@ -128,7 +128,7 @@ const _httpServerSpansIntegration = ((options: HttpServerSpansIntegrationOptions const ips = headers['x-forwarded-for']; const httpVersion = request.httpVersion; const host = headers.host; - const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, '$1') || 'localhost'; + const hostname = host?.replace(/^(.*):\d{1,5}/, '$1') || 'localhost'; const tracer = client.tracer; const scheme = fullUrl.startsWith('https') ? 'https' : 'http'; @@ -275,12 +275,12 @@ function isKnownPrefetchRequest(req: IncomingMessage): boolean { export function isStaticAssetRequest(urlPath: string): boolean { const path = stripUrlQueryAndFragment(urlPath); // Common static file extensions - if (path.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) { + if (path.match(/\.(?:ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) { return true; } // Common metadata files - if (path.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) { + if (path.match(/^\/(?:robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) { return true; } diff --git a/packages/node-core/src/utils/getRequestUrl.ts b/packages/node-core/src/utils/getRequestUrl.ts index 5005224f59e0..72c11fc6ecb2 100644 --- a/packages/node-core/src/utils/getRequestUrl.ts +++ b/packages/node-core/src/utils/getRequestUrl.ts @@ -7,9 +7,11 @@ export function getRequestUrl(requestOptions: RequestOptions): string { // Don't log standard :80 (http) and :443 (https) ports to reduce the noise // Also don't add port if the hostname already includes a port const port = - !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) + !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^.*:\d+$/.test(hostname) ? '' : `:${requestOptions.port}`; const path = requestOptions.path ? requestOptions.path : '/'; return `${protocol}//${hostname}${port}${path}`; } + +// ^.*:\d+$ diff --git a/packages/node-core/test/integration/transactions.test.ts b/packages/node-core/test/integration/transactions.test.ts index 7b13a400dedb..2e4dc3d23eb4 100644 --- a/packages/node-core/test/integration/transactions.test.ts +++ b/packages/node-core/test/integration/transactions.test.ts @@ -91,9 +91,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }); @@ -104,7 +104,7 @@ describe('Integration | Transactions', () => { sample_rate: '1', sampled: 'true', release: '8.0.0', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'test name', sample_rand: expect.any(String), }); @@ -134,12 +134,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, { data: { @@ -148,12 +148,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, ]); }); @@ -243,9 +243,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }, }), @@ -281,9 +281,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op b', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -384,9 +384,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value', 'sentry.sample_rate': 1, }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -419,9 +419,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value b', 'sentry.sample_rate': 1, }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -491,7 +491,7 @@ describe('Integration | Transactions', () => { 'sentry.source': 'task', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), parent_span_id: parentSpanId, status: 'ok', trace_id: traceId, @@ -525,8 +525,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), @@ -538,8 +538,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), diff --git a/packages/node/src/integrations/tracing/postgresjs.ts b/packages/node/src/integrations/tracing/postgresjs.ts index 1a0eae973bc6..c0ba06fb9112 100644 --- a/packages/node/src/integrations/tracing/postgresjs.ts +++ b/packages/node/src/integrations/tracing/postgresjs.ts @@ -286,7 +286,7 @@ export class PostgresJsInstrumentation extends InstrumentationBase { 'test.outer': 'test value', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }); @@ -104,7 +104,7 @@ describe('Integration | Transactions', () => { sample_rate: '1', sampled: 'true', release: '8.0.0', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'test name', sample_rand: expect.any(String), }); @@ -134,12 +134,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, { data: { @@ -148,12 +148,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, ]); }); @@ -243,9 +243,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }, }), @@ -281,9 +281,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op b', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -384,9 +384,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value', 'sentry.sample_rate': 1, }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -419,9 +419,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value b', 'sentry.sample_rate': 1, }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -491,7 +491,7 @@ describe('Integration | Transactions', () => { 'sentry.source': 'task', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), parent_span_id: parentSpanId, status: 'ok', trace_id: traceId, @@ -525,8 +525,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), @@ -538,8 +538,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), diff --git a/packages/nuxt/src/runtime/plugins/storage.server.ts b/packages/nuxt/src/runtime/plugins/storage.server.ts index 710424d6995e..1a12bd1d0199 100644 --- a/packages/nuxt/src/runtime/plugins/storage.server.ts +++ b/packages/nuxt/src/runtime/plugins/storage.server.ts @@ -244,7 +244,7 @@ function normalizeKey(key: unknown, prefix: string): string { return `${prefix}${isEmptyValue(key) ? '' : String(key)}`; } -const CACHED_FN_HANDLERS_RE = /^nitro:(functions|handlers):/i; +const CACHED_FN_HANDLERS_RE = /^nitro:(?:functions|handlers):/i; /** * Since Nitro's cache may not utilize the driver's TTL, it is possible that the value is present in the cache but won't be used by Nitro. diff --git a/packages/nuxt/src/server/sdk.ts b/packages/nuxt/src/server/sdk.ts index edbd26b3d707..936cf8b399ad 100644 --- a/packages/nuxt/src/server/sdk.ts +++ b/packages/nuxt/src/server/sdk.ts @@ -45,7 +45,7 @@ export function lowQualityTransactionsFilter(options: SentryNuxtServerOptions): } // Check if this looks like a parametrized route (contains :param or :param() patterns) - const hasRouteParameters = /\/:[^(/\s]*(\([^)]*\))?[^/\s]*/.test(event.transaction); + const hasRouteParameters = /\/:[^(/\s]*(?:\([^)]*\))?[^/\s]*/.test(event.transaction); if (hasRouteParameters) { return event; diff --git a/packages/nuxt/src/vite/middlewareConfig.ts b/packages/nuxt/src/vite/middlewareConfig.ts index d851345172d8..2b472f6c4da2 100644 --- a/packages/nuxt/src/vite/middlewareConfig.ts +++ b/packages/nuxt/src/vite/middlewareConfig.ts @@ -77,7 +77,7 @@ function middlewareInstrumentationPlugin(nitro: Nitro): InputPluginOption { */ function wrapMiddlewareCode(originalCode: string, fileName: string): string { // Remove common file extensions - const cleanFileName = fileName.replace(/\.(ts|js|mjs|mts|cts)$/, ''); + const cleanFileName = fileName.replace(/\.(?:ts|js|mjs|mts|cts)$/, ''); return ` import { wrapMiddlewareHandlerWithSentry } from '#imports'; diff --git a/packages/nuxt/src/vite/sourceMaps.ts b/packages/nuxt/src/vite/sourceMaps.ts index 481a5910e024..3203d7fe4bb0 100644 --- a/packages/nuxt/src/vite/sourceMaps.ts +++ b/packages/nuxt/src/vite/sourceMaps.ts @@ -131,7 +131,7 @@ export function setupSourceMaps(moduleOptions: SentryNuxtModuleOptions, nuxt: Nu * Normalizes the beginning of a path from e.g. ../../../ to ./ */ function normalizePath(path: string): string { - return path.replace(/^(\.\.\/)+/, './'); + return path.replace(/^(?:\.\.\/)+/, './'); } /** diff --git a/packages/nuxt/src/vite/utils.ts b/packages/nuxt/src/vite/utils.ts index fc55ebf412c2..d22801a6fe55 100644 --- a/packages/nuxt/src/vite/utils.ts +++ b/packages/nuxt/src/vite/utils.ts @@ -50,7 +50,7 @@ export function findDefaultSdkInitFile(type: 'server' | 'client', nuxt?: Nuxt): * Extracts the filename from a node command with a path. */ export function getFilenameFromNodeStartCommand(nodeCommand: string): string | null { - const regex = /[^/\\]+\.[^/\\]+$/; + const regex = /[^/\\][^./\\]*\.[^/\\]+$/; const match = nodeCommand.match(regex); return match ? match[0] : null; } @@ -82,10 +82,10 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s // Regex matches the comma-separated params between the functions query // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor const wrapRegex = new RegExp( - `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`, + `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(?:\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`, ); // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor - const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`); + const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)\\${QUERY_END_INDICATOR}`); const wrapMatch = query.match(wrapRegex); const reexportMatch = query.match(reexportRegex); diff --git a/packages/opentelemetry/test/integration/transactions.test.ts b/packages/opentelemetry/test/integration/transactions.test.ts index 570df4a86aa8..5635cbd5b005 100644 --- a/packages/opentelemetry/test/integration/transactions.test.ts +++ b/packages/opentelemetry/test/integration/transactions.test.ts @@ -106,9 +106,9 @@ describe('Integration | Transactions', () => { 'test.outer': 'test value', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }); @@ -118,7 +118,7 @@ describe('Integration | Transactions', () => { public_key: expect.any(String), sample_rate: '1', sampled: 'true', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), transaction: 'test name', release: '8.0.0', sample_rand: expect.any(String), @@ -149,12 +149,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, { data: { @@ -163,12 +163,12 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, ]); }); @@ -258,9 +258,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'auto.test', }, }), @@ -296,9 +296,9 @@ describe('Integration | Transactions', () => { 'sentry.sample_rate': 1, }, op: 'test op b', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), status: 'ok', - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', }, }), @@ -373,7 +373,7 @@ describe('Integration | Transactions', () => { 'sentry.source': 'task', }, op: 'test op', - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), parent_span_id: parentSpanId, status: 'ok', trace_id: traceId, @@ -407,8 +407,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 1', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), @@ -420,8 +420,8 @@ describe('Integration | Transactions', () => { }, description: 'inner span 2', origin: 'manual', - parent_span_id: expect.stringMatching(/[a-f0-9]{16}/), - span_id: expect.stringMatching(/[a-f0-9]{16}/), + parent_span_id: expect.stringMatching(/[a-f\d]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), start_timestamp: expect.any(Number), status: 'ok', timestamp: expect.any(Number), diff --git a/packages/opentelemetry/test/propagator.test.ts b/packages/opentelemetry/test/propagator.test.ts index 46d4be5d8275..f96d92b7857f 100644 --- a/packages/opentelemetry/test/propagator.test.ts +++ b/packages/opentelemetry/test/propagator.test.ts @@ -59,7 +59,7 @@ describe('SentryPropagator', () => { 'sentry-trace_id=d4cda95b652f4a1592b449d5929fda1b', ].sort(), ); - expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f0-9]{16}-1/); + expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f\d]{16}-1/); }); }); @@ -96,7 +96,7 @@ describe('SentryPropagator', () => { 'sentry-replay_id=dsc_replay_id', ].sort(), ); - expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f0-9]{16}-1/); + expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f\d]{16}-1/); }); }); @@ -134,7 +134,7 @@ describe('SentryPropagator', () => { 'sentry-sampled=true', 'sentry-trace_id=d4cda95b652f4a1592b449d5929fda1b', 'sentry-transaction=test', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), ], 'd4cda95b652f4a1592b449d5929fda1b-{{spanId}}-1', true, @@ -187,7 +187,7 @@ describe('SentryPropagator', () => { 'sentry-sampled=true', 'sentry-trace_id=d4cda95b652f4a1592b449d5929fda1b', 'sentry-transaction=test', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), ], 'd4cda95b652f4a1592b449d5929fda1b-{{spanId}}-1', undefined, @@ -336,7 +336,7 @@ describe('SentryPropagator', () => { 'sentry-sampled=true', 'sentry-trace_id=d4cda95b652f4a1592b449d5929fda1b', 'sentry-transaction=test', - expect.stringMatching(/sentry-sample_rand=0\.[0-9]+/), + expect.stringMatching(/sentry-sample_rand=0\.\d+/), ].forEach(item => { expect(baggageToArray(carrier[SENTRY_BAGGAGE_HEADER])).toContainEqual(item); }); @@ -378,7 +378,7 @@ describe('SentryPropagator', () => { ].sort(), ); // Used spanId is a random ID, not from the remote span - expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f0-9]{16}/); + expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f\d]{16}/); expect(carrier[SENTRY_TRACE_HEADER]).not.toBe('d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92'); }); }, @@ -416,7 +416,7 @@ describe('SentryPropagator', () => { ].sort(), ); // Used spanId is a random ID, not from the remote span - expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f0-9]{16}-0/); + expect(carrier[SENTRY_TRACE_HEADER]).toMatch(/d4cda95b652f4a1592b449d5929fda1b-[a-f\d]{16}-0/); expect(carrier[SENTRY_TRACE_HEADER]).not.toBe('d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-0'); }); }, @@ -602,7 +602,7 @@ describe('SentryPropagator', () => { const context = propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter); expect(trace.getSpanContext(context)).toEqual(undefined); expect(getCurrentScope().getPropagationContext()).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), sampleRand: expect.any(Number), }); }); @@ -654,7 +654,7 @@ describe('SentryPropagator', () => { const context = propagator.extract(ROOT_CONTEXT, carrier, defaultTextMapGetter); expect(trace.getSpanContext(context)).toEqual(undefined); expect(getCurrentScope().getPropagationContext()).toEqual({ - traceId: expect.stringMatching(/[a-f0-9]{32}/), + traceId: expect.stringMatching(/[a-f\d]{32}/), sampleRand: expect.any(Number), }); }); diff --git a/packages/opentelemetry/test/spanExporter.test.ts b/packages/opentelemetry/test/spanExporter.test.ts index 1f233c65c055..b3b899be30f0 100644 --- a/packages/opentelemetry/test/spanExporter.test.ts +++ b/packages/opentelemetry/test/spanExporter.test.ts @@ -26,8 +26,8 @@ describe('createTransactionForOtelSpan', () => { expect(event).toEqual({ contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'sentry.source': 'custom', 'sentry.sample_rate': 1, @@ -74,8 +74,8 @@ describe('createTransactionForOtelSpan', () => { expect(event).toEqual({ contexts: { trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), data: { 'sentry.source': 'custom', 'sentry.sample_rate': 1, diff --git a/packages/opentelemetry/test/trace.test.ts b/packages/opentelemetry/test/trace.test.ts index 173bd6359a5f..c6033824d65a 100644 --- a/packages/opentelemetry/test/trace.test.ts +++ b/packages/opentelemetry/test/trace.test.ts @@ -482,8 +482,8 @@ describe('trace', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', status: 'ok', }); @@ -507,7 +507,7 @@ describe('trace', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', status: 'ok', @@ -778,8 +778,8 @@ describe('trace', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', status: 'ok', }); @@ -803,7 +803,7 @@ describe('trace', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', status: 'ok', @@ -1146,8 +1146,8 @@ describe('trace', () => { 'sentry.sample_rate': 1, 'sentry.origin': 'manual', }, - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), origin: 'manual', status: 'ok', }); @@ -1171,7 +1171,7 @@ describe('trace', () => { 'sentry.origin': 'manual', }, parent_span_id: innerParentSpanId, - span_id: expect.stringMatching(/[a-f0-9]{16}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), trace_id: outerTraceId, origin: 'manual', status: 'ok', @@ -1222,7 +1222,7 @@ describe('trace', () => { expect(span).toBeDefined(); const traceId = spanToJSON(span).trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanToJSON(span).parent_span_id).toBe(undefined); expect(spanToJSON(span).trace_id).not.toEqual(propagationContext.traceId); @@ -1247,7 +1247,7 @@ describe('trace', () => { expect(span).toBeDefined(); const traceId = spanToJSON(span).trace_id; - expect(traceId).toMatch(/[a-f0-9]{32}/); + expect(traceId).toMatch(/[a-f\d]{32}/); expect(spanToJSON(span).parent_span_id).toBe(undefined); expect(spanToJSON(span).trace_id).not.toEqual(propagationContext.traceId); @@ -1707,9 +1707,9 @@ describe('trace (sampling)', () => { startSpan({ name: 'outer' }, span => { expect(span.isRecording()).toBe(true); expect(span.spanContext().spanId).not.toBe('INVALID'); - expect(span.spanContext().spanId).toMatch(/[a-f0-9]{16}/); + expect(span.spanContext().spanId).toMatch(/[a-f\d]{16}/); expect(span.spanContext().traceId).not.toBe(traceId); - expect(span.spanContext().traceId).toMatch(/[a-f0-9]{32}/); + expect(span.spanContext().traceId).toMatch(/[a-f\d]{32}/); }); }); }); diff --git a/packages/opentelemetry/test/utils/getTraceData.test.ts b/packages/opentelemetry/test/utils/getTraceData.test.ts index d94e86930619..4ab94a5abe5b 100644 --- a/packages/opentelemetry/test/utils/getTraceData.test.ts +++ b/packages/opentelemetry/test/utils/getTraceData.test.ts @@ -73,7 +73,7 @@ describe('getTraceData', () => { const traceData = getTraceData({ client: customClient, scope }); - expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f0-9]{16}$/); + expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f\d]{16}$/); expect(traceData.baggage).toEqual( 'sentry-environment=production,sentry-public_key=123,sentry-trace_id=12345678901234567890123456789012', ); @@ -93,7 +93,7 @@ describe('getTraceData', () => { const traceData = getTraceData(); - expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f0-9]{16}-1$/); + expect(traceData['sentry-trace']).toMatch(/^12345678901234567890123456789012-[a-f\d]{16}-1$/); expect(traceData.baggage).toEqual( 'sentry-environment=staging,sentry-public_key=key,sentry-trace_id=12345678901234567890123456789012', ); diff --git a/packages/opentelemetry/test/utils/setupEventContextTrace.test.ts b/packages/opentelemetry/test/utils/setupEventContextTrace.test.ts index 19c8e178c160..63869455fa9a 100644 --- a/packages/opentelemetry/test/utils/setupEventContextTrace.test.ts +++ b/packages/opentelemetry/test/utils/setupEventContextTrace.test.ts @@ -51,8 +51,8 @@ describe('setupEventContextTrace', () => { expect.objectContaining({ contexts: expect.objectContaining({ trace: { - span_id: expect.stringMatching(/[a-f0-9]{16}/), - trace_id: expect.stringMatching(/[a-f0-9]{32}/), + span_id: expect.stringMatching(/[a-f\d]{16}/), + trace_id: expect.stringMatching(/[a-f\d]{32}/), }, }), }), diff --git a/packages/react-router/test/client/react-exports.test.ts b/packages/react-router/test/client/react-exports.test.ts index cae5ac56208a..4fe8035608d7 100644 --- a/packages/react-router/test/client/react-exports.test.ts +++ b/packages/react-router/test/client/react-exports.test.ts @@ -38,7 +38,7 @@ describe('Re-exports from React SDK', () => { const result = captureReactException(error, errorInfo); expect(typeof result).toBe('string'); - expect(result).toMatch(/^[a-f0-9]{32}$/); // assuming event ID is a 32-character hex string + expect(result).toMatch(/^[a-f\d]{32}$/); // assuming event ID is a 32-character hex string }); }); diff --git a/packages/replay-internal/src/util/maskAttribute.ts b/packages/replay-internal/src/util/maskAttribute.ts index 12daaeb97dff..9ef5cb403922 100644 --- a/packages/replay-internal/src/util/maskAttribute.ts +++ b/packages/replay-internal/src/util/maskAttribute.ts @@ -36,7 +36,7 @@ export function maskAttribute({ // type (key === 'value' && el.tagName === 'INPUT' && ['submit', 'button'].includes(el.getAttribute('type') || '')) ) { - return value.replace(/[\S]/g, '*'); + return value.replace(/\S/g, '*'); } return value; diff --git a/packages/solidstart/src/config/addInstrumentation.ts b/packages/solidstart/src/config/addInstrumentation.ts index fe141f92c2ea..df0234bae793 100644 --- a/packages/solidstart/src/config/addInstrumentation.ts +++ b/packages/solidstart/src/config/addInstrumentation.ts @@ -46,7 +46,7 @@ export async function addInstrumentationFileToBuild(nitro: Nitro): Promise const ssrAssetsPath = path.resolve(buildDir, 'build', 'ssr', 'assets'); const assetsBuildDir = await fs.promises.readdir(ssrAssetsPath); const releaseInjectionFile = assetsBuildDir.find(file => - /^_sentry-release-injection-file-.*\.(js|mjs)$/.test(file), + /^_sentry-release-injection-file-.*\.(?:js|mjs)$/.test(file), ); if (releaseInjectionFile) { diff --git a/packages/solidstart/src/config/utils.ts b/packages/solidstart/src/config/utils.ts index f0f11b4d4baa..2d848b68d381 100644 --- a/packages/solidstart/src/config/utils.ts +++ b/packages/solidstart/src/config/utils.ts @@ -25,9 +25,10 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s // Regex matches the comma-separated params between the functions query // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor const wrapRegex = new RegExp( + // eslint-disable-next-line regexp/no-unused-capturing-group `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`, ); - // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor + // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor,regexp/no-unused-capturing-group const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`); const wrapMatch = query.match(wrapRegex); diff --git a/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts b/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts index 8f8c7a59f1f4..a3477054b2b4 100644 --- a/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts +++ b/packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts @@ -138,9 +138,10 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s // Regex matches the comma-separated params between the functions query // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor const wrapRegex = new RegExp( + // eslint-disable-next-line regexp/no-unused-capturing-group `\\${SENTRY_WRAPPED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR}|\\${SENTRY_REEXPORTED_FUNCTIONS})`, ); - // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor + // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor,regexp/no-unused-capturing-group const reexportRegex = new RegExp(`\\${SENTRY_REEXPORTED_FUNCTIONS}(.*?)(\\${QUERY_END_INDICATOR})`); const wrapMatch = query.match(wrapRegex); diff --git a/packages/svelte/src/preprocessors.ts b/packages/svelte/src/preprocessors.ts index c7df0e258c0f..17e073a7a95e 100644 --- a/packages/svelte/src/preprocessors.ts +++ b/packages/svelte/src/preprocessors.ts @@ -124,6 +124,7 @@ function hasScriptTag(content: string): boolean { // They use this regex to find matching script tags that are passed to the `script` preprocessor hook: // https://github.com/sveltejs/svelte/blob/bb83eddfc623437528f24e9fe210885b446e72fa/src/compiler/preprocess/index.ts#L144 // However, we remove the first part of the regex to not match HTML comments + // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/no-unused-capturing-group, regexp/match-any const scriptTagRegex = /([^]*?)<\/script\s*>|\/>)/gi; // Regex testing is not a super safe way of checking for the presence of a