@@ -359,6 +359,103 @@ describe('withSentryConfig', () => {
359359 expect ( finalConfigOld . webpack ) . toBeInstanceOf ( Function ) ;
360360 } ) ;
361361 } ) ;
362+
363+ describe ( 'deprecation warnings' , ( ) => {
364+ let consoleWarnSpy : ReturnType < typeof vi . spyOn > ;
365+
366+ beforeEach ( ( ) => {
367+ consoleWarnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
368+ } ) ;
369+
370+ afterEach ( ( ) => {
371+ consoleWarnSpy . mockRestore ( ) ;
372+ delete process . env . TURBOPACK ;
373+ vi . restoreAllMocks ( ) ;
374+ } ) ;
375+
376+ it ( 'warns when using deprecated top-level options' , ( ) => {
377+ delete process . env . TURBOPACK ;
378+
379+ const sentryOptions = {
380+ disableLogger : true ,
381+ widenClientFileUpload : true ,
382+ } ;
383+
384+ materializeFinalNextConfig ( exportedNextConfig , undefined , sentryOptions ) ;
385+
386+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
387+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: disableLogger is deprecated' ) ,
388+ ) ;
389+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith ( expect . stringContaining ( 'Use webpack.treeshake.debugLogs instead' ) ) ;
390+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
391+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: widenClientFileUpload is deprecated' ) ,
392+ ) ;
393+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
394+ expect . stringContaining ( 'Use webpack.widenClientFileUpload instead' ) ,
395+ ) ;
396+ } ) ;
397+
398+ it ( 'does not warn when using new webpack path' , ( ) => {
399+ delete process . env . TURBOPACK ;
400+
401+ const sentryOptions = {
402+ webpack : {
403+ treeshake : {
404+ debugLogs : true ,
405+ } ,
406+ widenClientFileUpload : true ,
407+ } ,
408+ } ;
409+
410+ materializeFinalNextConfig ( exportedNextConfig , undefined , sentryOptions ) ;
411+
412+ expect ( consoleWarnSpy ) . not . toHaveBeenCalled ( ) ;
413+ } ) ;
414+
415+ it ( 'warns even when new path is also set' , ( ) => {
416+ delete process . env . TURBOPACK ;
417+
418+ const sentryOptions = {
419+ disableLogger : true , // deprecated
420+ webpack : {
421+ treeshake : {
422+ debugLogs : false , // new path takes precedence
423+ } ,
424+ } ,
425+ } ;
426+
427+ materializeFinalNextConfig ( exportedNextConfig , undefined , sentryOptions ) ;
428+
429+ // Should warn because deprecated value is present
430+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
431+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: disableLogger is deprecated' ) ,
432+ ) ;
433+ } ) ;
434+
435+ it ( 'warns for multiple deprecated options at once' , ( ) => {
436+ delete process . env . TURBOPACK ;
437+
438+ const sentryOptions = {
439+ disableLogger : true ,
440+ automaticVercelMonitors : false ,
441+ excludeServerRoutes : [ '/api/test' ] ,
442+ } ;
443+
444+ materializeFinalNextConfig ( exportedNextConfig , undefined , sentryOptions ) ;
445+
446+ // Should warn for all three deprecated options
447+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
448+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: disableLogger is deprecated' ) ,
449+ ) ;
450+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
451+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: automaticVercelMonitors is deprecated' ) ,
452+ ) ;
453+ expect ( consoleWarnSpy ) . toHaveBeenCalledWith (
454+ expect . stringContaining ( '[@sentry/nextjs] DEPRECATION WARNING: excludeServerRoutes is deprecated' ) ,
455+ ) ;
456+ expect ( consoleWarnSpy ) . toHaveBeenCalledTimes ( 3 ) ;
457+ } ) ;
458+ } ) ;
362459 } ) ;
363460
364461 describe ( 'bundler detection' , ( ) => {
0 commit comments