Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
workaround for failing test
  • Loading branch information
chargome committed Sep 15, 2025
commit e63d9b21b17ea5bb4002d3df478fb3de55c158c4
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ test('Should create a transaction for route handlers and correctly set span stat
expect(routehandlerTransaction.contexts?.trace?.op).toBe('http.server');
});

// Will be resolved by https://github.com/vercel/next.js/issues/82612
test.fail('Should record exceptions and transactions for faulty route handlers', async ({ request }) => {
test('Should record exceptions and transactions for faulty route handlers', async ({ request }) => {
Comment thread
chargome marked this conversation as resolved.
const errorEventPromise = waitForError('nextjs-turbo', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Dynamic route handler error';
});
Expand All @@ -57,6 +56,28 @@ test.fail('Should record exceptions and transactions for faulty route handlers',

await request.get('/route-handlers/boop/error').catch(() => {});

// Expect this to timeout due to upstream Next.js issue https://github.com/vercel/next.js/issues/82612
// When the issue is fixed, this test should fail (because it won't timeout anymore)
const timeoutDuration = 25000; // Less than the 30s test timeout

try {
await Promise.race([
Promise.all([routehandlerTransactionPromise, errorEventPromise]),
new Promise((_, reject) =>
setTimeout(() => reject(new Error('Expected timeout - upstream issue still exists')), timeoutDuration),
),
]);

// If we get here, the upstream issue has been fixed
throw new Error('Test should have timed out - upstream issue may be fixed.');
} catch (error) {
// Expected timeout - test passes
if (error instanceof Error && error.message.includes('Expected timeout')) {
return;
}
throw error;
}

const routehandlerTransaction = await routehandlerTransactionPromise;
const routehandlerError = await errorEventPromise;

Expand Down