Skip to content

Commit 9496c99

Browse files
author
Luca Forstner
committed
fix canary tests I missed in #13154
1 parent f8f0590 commit 9496c99

File tree

7 files changed

+15
-14
lines changed

7 files changed

+15
-14
lines changed

dev-packages/e2e-tests/test-applications/nextjs-13/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
},
2525
"devDependencies": {
2626
"@playwright/test": "^1.44.1",
27-
"@sentry-internal/test-utils": "link:../../../test-utils",
27+
"@sentry-internal/browser-utils": "latest || *",
2828
"@sentry-internal/feedback": "latest || *",
29+
"@sentry-internal/replay": "latest || *",
2930
"@sentry-internal/replay-canvas": "latest || *",
30-
"@sentry-internal/browser-utils": "latest || *",
31+
"@sentry-internal/test-utils": "link:../../../test-utils",
3132
"@sentry/browser": "latest || *",
3233
"@sentry/core": "latest || *",
3334
"@sentry/nextjs": "latest || *",
3435
"@sentry/node": "latest || *",
3536
"@sentry/opentelemetry": "latest || *",
3637
"@sentry/react": "latest || *",
37-
"@sentry-internal/replay": "latest || *",
3838
"@sentry/types": "latest || *",
3939
"@sentry/utils": "latest || *",
4040
"@sentry/vercel-edge": "latest || *"
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { NextApiRequest, NextApiResponse } from 'next';
22

3-
const handler = async (_req: NextApiRequest, res: NextApiResponse): Promise<void> => {
3+
export default async (_req: NextApiRequest, res: NextApiResponse): Promise<void> => {
44
res.status(200).json({ success: true });
55
};
6-
7-
module.exports = handler;
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { NextApiRequest, NextApiResponse } from 'next';
22

3-
const handler = async (_req: NextApiRequest, res: NextApiResponse): Promise<void> => {
3+
export default async (_req: NextApiRequest, res: NextApiResponse): Promise<void> => {
44
res.status(200).json({ success: true });
55
};
6-
7-
module.exports = handler;

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/cjs-api-endpoints.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { expect, test } from '@playwright/test';
22
import { waitForTransaction } from '@sentry-internal/test-utils';
33

4+
const packageJson = require('../../package.json');
5+
const nextjsVersion = packageJson.dependencies.next;
6+
const nextjsMajor = Number(nextjsVersion.split('.')[0]);
7+
48
test('should create a transaction for a CJS pages router API endpoint', async ({ request }) => {
9+
test.skip(nextjsMajor > 13, 'Next.js does not like CJS routes after a certain point.');
10+
511
const transactionPromise = waitForTransaction('nextjs-13', async transactionEvent => {
612
return (
713
transactionEvent.transaction === 'GET /api/cjs-api-endpoint' &&
@@ -62,6 +68,8 @@ test('should create a transaction for a CJS pages router API endpoint', async ({
6268
});
6369

6470
test('should not mess up require statements in CJS API endpoints', async ({ request }) => {
71+
test.skip(nextjsMajor > 13, 'Next.js does not like CJS routes after a certain point.');
72+
6573
const transactionPromise = waitForTransaction('nextjs-13', async transactionEvent => {
6674
return (
6775
transactionEvent.transaction === 'GET /api/cjs-api-endpoint-with-require' &&

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/excluded-api-endpoints.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ test('should not automatically create transactions for routes that were excluded
1111
);
1212
});
1313

14-
await (await request.get(`/api/endpoint-excluded-with-string`)).json();
14+
expect(await (await request.get(`/api/endpoint-excluded-with-string`)).text()).toBe('{"success":true}');
1515

1616
let transactionPromiseReceived = false;
1717
transactionPromise.then(() => {
@@ -33,7 +33,7 @@ test('should not automatically create transactions for routes that were excluded
3333
);
3434
});
3535

36-
await (await request.get(`/api/endpoint-excluded-with-regex`)).json();
36+
expect(await (await request.get(`/api/endpoint-excluded-with-regex`)).text()).toBe('{"success":true}');
3737

3838
let transactionPromiseReceived = false;
3939
transactionPromise.then(() => {

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/server-component-error.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ test('Should capture an error thrown in a server component', async ({ page }) =>
1212
contexts: {
1313
runtime: { name: 'node', version: expect.any(String) },
1414
trace: {
15-
parent_span_id: expect.any(String),
1615
span_id: expect.any(String),
1716
trace_id: expect.any(String),
1817
},
@@ -27,7 +26,6 @@ test('Should capture an error thrown in a server component', async ({ page }) =>
2726
},
2827
],
2928
},
30-
modules: { next: '13.2.0' },
3129
platform: 'node',
3230
request: {
3331
cookies: expect.any(Object),

dev-packages/e2e-tests/test-applications/nextjs-13/tests/server/wrapApiHandlerWithSentry.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const cases = [
2222
cases.forEach(({ name, url, transactionName }) => {
2323
test(`Should capture transactions for routes with various shapes (${name})`, async ({ request }) => {
2424
const transactionEventPromise = waitForTransaction('nextjs-13', transactionEvent => {
25-
console.log({ t: transactionEvent.transaction });
2625
return transactionEvent.transaction === transactionName && transactionEvent.contexts?.trace?.op === 'http.server';
2726
});
2827

0 commit comments

Comments
 (0)