@@ -2,7 +2,7 @@ import { RewriteFrames } from '@sentry/integrations';
22import * as SentryNode from '@sentry/node' ;
33import { getCurrentHub , NodeClient } from '@sentry/node' ;
44import { Integration } from '@sentry/types' ;
5- import { getGlobalObject } from '@sentry/utils' ;
5+ import { getGlobalObject , logger , SentryError } from '@sentry/utils' ;
66import * as domain from 'domain' ;
77
88import { init } from '../src/index.server' ;
@@ -16,6 +16,7 @@ const global = getGlobalObject();
1616( global as typeof global & { __rewriteFramesDistDir__ : string } ) . __rewriteFramesDistDir__ = '.next' ;
1717
1818const nodeInit = jest . spyOn ( SentryNode , 'init' ) ;
19+ const logError = jest . spyOn ( logger , 'error' ) ;
1920
2021describe ( 'Server init()' , ( ) => {
2122 afterEach ( ( ) => {
@@ -87,6 +88,18 @@ describe('Server init()', () => {
8788 expect ( currentScope . _tags . vercel ) . toBeUndefined ( ) ;
8889 } ) ;
8990
91+ it ( 'adds 404 transaction filter' , ( ) => {
92+ init ( {
93+ dsn :
'https://[email protected] /12312012' , 94+ tracesSampleRate : 1.0 ,
95+ } ) ;
96+
97+ const transaction = getCurrentHub ( ) . startTransaction ( { name : '/404' } ) ;
98+ transaction . finish ( ) ;
99+
100+ expect ( logError ) . toHaveBeenCalledWith ( new SentryError ( 'An event processor returned null, will not send event.' ) ) ;
101+ } ) ;
102+
90103 it ( "initializes both global hub and domain hub when there's an active domain" , ( ) => {
91104 const globalHub = getCurrentHub ( ) ;
92105 const local = domain . create ( ) ;
0 commit comments