@@ -138,7 +138,7 @@ describe('Spotlight', () => {
138138 integration . setup ( client ) ;
139139
140140 expect ( loggerSpy ) . toHaveBeenCalledWith (
141- expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spoltight enabled?" ) ,
141+ expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spotlight enabled?" ) ,
142142 ) ;
143143
144144 process . env . NODE_ENV = oldEnvValue ;
@@ -152,9 +152,41 @@ describe('Spotlight', () => {
152152 integration . setup ( client ) ;
153153
154154 expect ( loggerSpy ) . not . toHaveBeenCalledWith (
155- expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spoltight enabled?" ) ,
155+ expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spotlight enabled?" ) ,
156156 ) ;
157157
158158 process . env . NODE_ENV = oldEnvValue ;
159159 } ) ;
160+
161+ it ( 'handles `process` not being available' , ( ) => {
162+ const originalProcess = process ;
163+
164+ // @ts -expect-error - TS complains but we explicitly wanna test this
165+ delete global . process ;
166+
167+ const integration = new Spotlight ( { sidecarUrl : 'http://localhost:8969' } ) ;
168+ integration . setup ( client ) ;
169+
170+ expect ( loggerSpy ) . not . toHaveBeenCalledWith (
171+ expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spotlight enabled?" ) ,
172+ ) ;
173+
174+ global . process = originalProcess ;
175+ } ) ;
176+
177+ it ( 'handles `process.env` not being available' , ( ) => {
178+ const originalEnv = process . env ;
179+
180+ // @ts -expect-error - TS complains but we explicitly wanna test this
181+ delete process . env ;
182+
183+ const integration = new Spotlight ( { sidecarUrl : 'http://localhost:8969' } ) ;
184+ integration . setup ( client ) ;
185+
186+ expect ( loggerSpy ) . not . toHaveBeenCalledWith (
187+ expect . stringContaining ( "It seems you're not in dev mode. Do you really want to have Spotlight enabled?" ) ,
188+ ) ;
189+
190+ process . env = originalEnv ;
191+ } ) ;
160192} ) ;
0 commit comments