diff --git a/tests/mocks/index.ts b/tests/mocks/index.ts index 6c6e22db3..58a4e9f3d 100644 --- a/tests/mocks/index.ts +++ b/tests/mocks/index.ts @@ -5,7 +5,20 @@ import { handlers as resendHandlers } from './resend.ts' export const server = setupServer(...resendHandlers, ...githubHandlers) -server.listen({ onUnhandledRequest: 'warn' }) +server.listen({ + onUnhandledRequest(request, print) { + // Do not print warnings on unhandled requests to https://<:userId>.ingest.us.sentry.io/api/ + // Note: a request handler with passthrough is not suited with this type of url + // until there is a more permissible url catching system + // like requested at https://github.com/mswjs/msw/issues/1804 + if (request.url.includes('.sentry.io')) { + return + } + + // Print the regular MSW unhandled request warning otherwise. + print.warning() + } +}) if (process.env.NODE_ENV !== 'test') { console.info('🔶 Mock server installed')