@@ -50,25 +50,29 @@ describe('spanStreamingIntegration', () => {
5050 expect ( client . getOptions ( ) . traceLifecycle ) . toBe ( 'stream' ) ;
5151 } ) ;
5252
53- it ( 'logs a warning if traceLifecycle is not set to "stream"' , ( ) => {
54- const debugSpy = vi . spyOn ( debug , 'warn' ) . mockImplementation ( ( ) => { } ) ;
55- const client = new BrowserClient ( {
56- ...getDefaultBrowserClientOptions ( ) ,
57- dsn : 'https://username@domain/123' ,
58- integrations : [ spanStreamingIntegration ( ) ] ,
59- traceLifecycle : 'static' ,
60- } ) ;
61-
62- SentryCore . setCurrentClient ( client ) ;
63- client . init ( ) ;
64-
65- expect ( debugSpy ) . toHaveBeenCalledWith (
66- 'SpanStreaming integration requires `traceLifecycle` to be set to "stream"! Falling back to static trace lifecycle.' ,
67- ) ;
68- debugSpy . mockRestore ( ) ;
69-
70- expect ( client . getOptions ( ) . traceLifecycle ) . toBe ( 'static' ) ;
71- } ) ;
53+ it . each ( [ 'static' , 'somethingElse' ] ) (
54+ 'logs a warning if traceLifecycle is not set to "stream" but to %s' ,
55+ traceLifecycle => {
56+ const debugSpy = vi . spyOn ( debug , 'warn' ) . mockImplementation ( ( ) => { } ) ;
57+ const client = new BrowserClient ( {
58+ ...getDefaultBrowserClientOptions ( ) ,
59+ dsn : 'https://username@domain/123' ,
60+ integrations : [ spanStreamingIntegration ( ) ] ,
61+ // @ts -expect-error - we want to test the warning for invalid traceLifecycle values
62+ traceLifecycle,
63+ } ) ;
64+
65+ SentryCore . setCurrentClient ( client ) ;
66+ client . init ( ) ;
67+
68+ expect ( debugSpy ) . toHaveBeenCalledWith (
69+ 'SpanStreaming integration requires `traceLifecycle` to be set to "stream"! Falling back to static trace lifecycle.' ,
70+ ) ;
71+ debugSpy . mockRestore ( ) ;
72+
73+ expect ( client . getOptions ( ) . traceLifecycle ) . toBe ( 'static' ) ;
74+ } ,
75+ ) ;
7276
7377 it ( 'falls back to static trace lifecycle if beforeSendSpan is not compatible with span streaming' , ( ) => {
7478 const debugSpy = vi . spyOn ( debug , 'warn' ) . mockImplementation ( ( ) => { } ) ;
0 commit comments