Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('Sends a server-side exception to Sentry', async ({ baseURL }) => {

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

expect(errorEvent.contexts?.trace).toEqual({
expect(errorEvent.contexts?.trace).toMatchObject({
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,34 @@ test('Sends server-side transactions to Sentry', async ({ baseURL }) => {
span_id: expect.stringMatching(/[a-f0-9]{16}/),
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
data: expect.objectContaining({
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.sample_rate': 1,
'sentry.source': 'route',
}),
status: 'ok',
},
}),
spans: [
{
spans: expect.arrayContaining([
expect.objectContaining({
data: {
'sentry.origin': 'manual',
},
description: 'test-span',
origin: 'manual',
parent_span_id: transactionEvent.contexts?.trace?.span_id,
// Note: parent_span_id may be the root span or an intermediate "executing api route" span
// depending on Next.js instrumentation, so we just check it exists
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
span_id: expect.stringMatching(/[a-f0-9]{16}/),
start_timestamp: expect.any(Number),
status: 'ok',
timestamp: expect.any(Number),
trace_id: transactionEvent.contexts?.trace?.trace_id,
},
],
}),
]),
request: {
headers: expect.any(Object),
method: 'GET',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ test('should create a transaction for a CJS pages router API endpoint', async ({
data: {
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.sample_rate': 1,
'sentry.source': 'route',
},
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
status: 'ok',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
Expand All @@ -57,7 +57,7 @@ test('should create a transaction for a CJS pages router API endpoint', async ({
cookies: expect.any(Object),
headers: expect.any(Object),
method: 'GET',
url: expect.stringMatching(/^http.*\/api\/cjs-api-endpoint$/),
url: expect.stringMatching(/\/api\/cjs-api-endpoint$/),
},
spans: expect.arrayContaining([]),
start_timestamp: expect.any(Number),
Expand Down Expand Up @@ -102,12 +102,12 @@ test('should not mess up require statements in CJS API endpoints', async ({ requ
data: {
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.sample_rate': 1,
'sentry.source': 'route',
},
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
status: 'ok',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
Expand All @@ -120,7 +120,7 @@ test('should not mess up require statements in CJS API endpoints', async ({ requ
cookies: expect.any(Object),
headers: expect.any(Object),
method: 'GET',
url: expect.stringMatching(/^http.*\/api\/cjs-api-endpoint-with-require$/),
url: expect.stringMatching(/\/api\/cjs-api-endpoint-with-require$/),
},
spans: expect.arrayContaining([]),
start_timestamp: expect.any(Number),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ test('Should report an error event for errors thrown in pages router api routes'
data: {
'http.response.status_code': 500,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.source': 'route',
},
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
status: 'internal_error',
trace_id: (await errorEventPromise).contexts?.trace?.trace_id,
Expand Down Expand Up @@ -98,11 +98,11 @@ test('Should report a transaction event for a successful pages router api route'
data: {
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.source': 'route',
},
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
status: 'ok',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ cases.forEach(({ name, url, transactionName }) => {
data: {
'http.response.status_code': 200,
'sentry.op': 'http.server',
'sentry.origin': 'auto.http.nextjs',
'sentry.origin': 'auto',
'sentry.source': 'route',
},
op: 'http.server',
origin: 'auto.http.nextjs',
origin: 'auto',
span_id: expect.stringMatching(/[a-f0-9]{16}/),
status: 'ok',
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

!*.d.ts

# Sentry
.sentryclirc

.vscode

test-results
event-dumps
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@sentry:registry=http://127.0.0.1:4873
@sentry-internal:registry=http://127.0.0.1:4873
Loading