@@ -230,43 +230,45 @@ suite('Global Pip in Terminal Trigger', () => {
230
230
sinon . assert . notCalled ( showWarningMessageStub ) ;
231
231
} ) ;
232
232
233
- test ( 'Should prompt to create environment if all conditions are met' , async ( ) => {
234
- shouldPromptToCreateEnvStub . returns ( true ) ;
235
- inExperimentStub . returns ( true ) ;
236
- isGlobalPythonSelectedStub . returns ( true ) ;
237
- showWarningMessageStub . resolves ( CreateEnv . Trigger . createEnvironment ) ;
238
-
239
- const disposables : Disposable [ ] = [ ] ;
240
- registerTriggerForPipInTerminal ( disposables ) ;
241
-
242
- await handler ?.( {
243
- terminal : ( { } as unknown ) as Terminal ,
244
- shellIntegration : shellIntegration . object ,
245
- execution : {
246
- cwd : workspace1 . uri ,
247
- commandLine : {
248
- isTrusted : true ,
249
- value : 'pip install' ,
250
- confidence : 0 ,
233
+ [ 'pip install' , 'pip3 install' , 'python -m pip install' , 'python3 -m pip install' ] . forEach ( ( command ) => {
234
+ test ( `Should prompt to create environment if all conditions are met: ${ command } ` , async ( ) => {
235
+ shouldPromptToCreateEnvStub . returns ( true ) ;
236
+ inExperimentStub . returns ( true ) ;
237
+ isGlobalPythonSelectedStub . returns ( true ) ;
238
+ showWarningMessageStub . resolves ( CreateEnv . Trigger . createEnvironment ) ;
239
+
240
+ const disposables : Disposable [ ] = [ ] ;
241
+ registerTriggerForPipInTerminal ( disposables ) ;
242
+
243
+ await handler ?.( {
244
+ terminal : ( { } as unknown ) as Terminal ,
245
+ shellIntegration : shellIntegration . object ,
246
+ execution : {
247
+ cwd : workspace1 . uri ,
248
+ commandLine : {
249
+ isTrusted : true ,
250
+ value : command ,
251
+ confidence : 0 ,
252
+ } ,
253
+ read : ( ) =>
254
+ ( async function * ( ) {
255
+ yield Promise . resolve ( command ) ;
256
+ } ) ( ) ,
251
257
} ,
252
- read : ( ) =>
253
- ( async function * ( ) {
254
- yield Promise . resolve ( 'pip install' ) ;
255
- } ) ( ) ,
256
- } ,
257
- } ) ;
258
+ } ) ;
258
259
259
- assert . strictEqual ( disposables . length , 1 ) ;
260
- sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
261
- sinon . assert . calledOnce ( inExperimentStub ) ;
262
- sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
263
- sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
264
- sinon . assert . calledOnce ( showWarningMessageStub ) ;
260
+ assert . strictEqual ( disposables . length , 1 ) ;
261
+ sinon . assert . calledOnce ( shouldPromptToCreateEnvStub ) ;
262
+ sinon . assert . calledOnce ( inExperimentStub ) ;
263
+ sinon . assert . calledOnce ( getWorkspaceFolderStub ) ;
264
+ sinon . assert . calledOnce ( isGlobalPythonSelectedStub ) ;
265
+ sinon . assert . calledOnce ( showWarningMessageStub ) ;
265
266
266
- sinon . assert . calledOnce ( executeCommandStub ) ;
267
- sinon . assert . notCalled ( disableCreateEnvironmentTriggerStub ) ;
267
+ sinon . assert . calledOnce ( executeCommandStub ) ;
268
+ sinon . assert . notCalled ( disableCreateEnvironmentTriggerStub ) ;
268
269
269
- shellIntegration . verify ( ( s ) => s . executeCommand ( typemoq . It . isAnyString ( ) ) , typemoq . Times . once ( ) ) ;
270
+ shellIntegration . verify ( ( s ) => s . executeCommand ( typemoq . It . isAnyString ( ) ) , typemoq . Times . once ( ) ) ;
271
+ } ) ;
270
272
} ) ;
271
273
272
274
test ( "Should disable create environment trigger if user selects don't show again" , async ( ) => {
0 commit comments