Skip to content

Commit 27e02e0

Browse files
committed
test: update expectations
1 parent da16ecf commit 27e02e0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

dev-packages/e2e-tests/test-applications/create-next-app/tests/server-errors.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test('Sends a server-side exception to Sentry', async ({ baseURL }) => {
2424

2525
expect(errorEvent.transaction).toEqual('GET /api/error');
2626

27-
expect(errorEvent.contexts?.trace).toEqual({
27+
expect(errorEvent.contexts?.trace).toMatchObject({
2828
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
2929
span_id: expect.stringMatching(/[a-f0-9]{16}/),
3030
});

dev-packages/e2e-tests/test-applications/create-next-app/tests/server-transactions.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,23 @@ test('Sends server-side transactions to Sentry', async ({ baseURL }) => {
3333
status: 'ok',
3434
},
3535
}),
36-
spans: [
37-
{
36+
spans: expect.arrayContaining([
37+
expect.objectContaining({
3838
data: {
3939
'sentry.origin': 'manual',
4040
},
4141
description: 'test-span',
4242
origin: 'manual',
43-
parent_span_id: transactionEvent.contexts?.trace?.span_id,
43+
// Note: parent_span_id may be the root span or an intermediate "executing api route" span
44+
// depending on Next.js instrumentation, so we just check it exists
45+
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
4446
span_id: expect.stringMatching(/[a-f0-9]{16}/),
4547
start_timestamp: expect.any(Number),
4648
status: 'ok',
4749
timestamp: expect.any(Number),
4850
trace_id: transactionEvent.contexts?.trace?.trace_id,
49-
},
50-
],
51+
}),
52+
]),
5153
request: {
5254
headers: expect.any(Object),
5355
method: 'GET',

0 commit comments

Comments
 (0)