@@ -138,7 +138,7 @@ describe('Spotlight', () => {
138
138
integration . setup ( client ) ;
139
139
140
140
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?" ) ,
142
142
) ;
143
143
144
144
process . env . NODE_ENV = oldEnvValue ;
@@ -152,9 +152,41 @@ describe('Spotlight', () => {
152
152
integration . setup ( client ) ;
153
153
154
154
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?" ) ,
156
156
) ;
157
157
158
158
process . env . NODE_ENV = oldEnvValue ;
159
159
} ) ;
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 globalThis . 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
+ globalThis . 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
+ } ) ;
160
192
} ) ;
0 commit comments