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
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ test.describe('Server Middleware Instrumentation', () => {
type: 'Error',
mechanism: expect.objectContaining({
handled: false,
type: 'auto.middleware.nuxt',
// Type changes depending on whether it is being wrapped by Nitro or not
// This is a timing problem, sometimes Nitro can capture the error first, and sometimes it can't
// If nitro captures the error first, the type will be 'chained'
// If Sentry captures the error first, the type will be 'auto.middleware.nuxt'
// type: 'auto.middleware.nuxt',
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment explains that the mechanism type changes based on race conditions, but the assertion no longer validates the mechanism type at all. Consider asserting that the type is either 'auto.middleware.nuxt' or 'chained' to maintain some test coverage:

type: expect.stringMatching(/^(auto\.middleware\.nuxt|chained)$/),

This would document the expected behavior while handling the race condition.

Copilot uses AI. Check for mistakes.
}),
}),
);
Expand Down