@@ -171,6 +171,11 @@ suite('Terminal Environment Activation conda', () => {
171171 expectedActivationCommamnd  =  [ `conda activate ${ envName . toCommandArgument ( ) }  ] ; 
172172 break ; 
173173 } 
174+  case  TerminalShellType . bash :
175+  case  TerminalShellType . gitbash : { 
176+  expectedActivationCommamnd  =  [ `source activate ${ envName . toCommandArgument ( ) }  ] ; 
177+  break ; 
178+  } 
174179 default : { 
175180 expectedActivationCommamnd  =  isWindows  ? [ `activate ${ envName . toCommandArgument ( ) }  ]  : [ `source activate ${ envName . toCommandArgument ( ) }  ] ; 
176181 break ; 
@@ -214,7 +219,7 @@ suite('Terminal Environment Activation conda', () => {
214219 await  expectNoCondaActivationCommandForPowershell ( false ,  true ,  false ,  pythonPath ,  shellType . value ,  true ) ; 
215220 } ) ; 
216221 } ) ; 
217-  async  function  expectCondaActivationCommand ( isWindows : boolean ,  isOsx : boolean ,  isLinux : boolean ,  pythonPath : string )  { 
222+  async  function  expectCondaActivationCommand ( isWindows : boolean ,  isOsx : boolean ,  isLinux : boolean ,  pythonPath : string ,   shellType :  TerminalShellType )  { 
218223 terminalSettings . setup ( t  =>  t . activateEnvironment ) . returns ( ( )  =>  true ) ; 
219224 platformService . setup ( p  =>  p . isLinux ) . returns ( ( )  =>  isLinux ) ; 
220225 platformService . setup ( p  =>  p . isWindows ) . returns ( ( )  =>  isWindows ) ; 
@@ -223,27 +228,29 @@ suite('Terminal Environment Activation conda', () => {
223228 pythonSettings . setup ( s  =>  s . pythonPath ) . returns ( ( )  =>  pythonPath ) ; 
224229 condaService . setup ( c  =>  c . getCondaEnvironment ( TypeMoq . It . isAny ( ) ) ) . returns ( ( )  =>  Promise . resolve ( {  name : 'EnvA' ,  path : path . dirname ( pythonPath )  } ) ) ; 
225230
226-  const  expectedActivationCommand  =  isWindows  ? [ 'activate EnvA' ]  : [ 'source activate EnvA' ] ; 
231+  const  expectedActivationCommand  =  isWindows  &&   ! ( TerminalShellType . bash   ||   TerminalShellType . gitbash )   ? [ 'activate EnvA' ]  : [ 'source activate EnvA' ] ; 
227232 const  activationCommands  =  await  terminalHelper . getEnvironmentActivationCommands ( TerminalShellType . bash ,  undefined ) ; 
228233 expect ( activationCommands ) . to . deep . equal ( expectedActivationCommand ,  'Incorrect Activation command' ) ; 
229234 } 
230235
231-  test ( 'If environment is a conda environment, ensure conda activation command is sent (windows)' ,  async  ( )  =>  { 
232-  const  pythonPath  =  path . join ( 'c' ,  'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'python.exe' ) ; 
233-  fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
234-  await  expectCondaActivationCommand ( true ,  false ,  false ,  pythonPath ) ; 
235-  } ) ; 
236+  getNamesAndValues < TerminalShellType > ( TerminalShellType ) . forEach ( shellType  =>  { 
237+  test ( `If environment is a conda environment, ensure conda activation command is sent for shell ${ shellType . name }  ,  async  ( )  =>  { 
238+  const  pythonPath  =  path . join ( 'c' ,  'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'python.exe' ) ; 
239+  fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
240+  await  expectCondaActivationCommand ( true ,  false ,  false ,  pythonPath ,  shellType . value ) ; 
241+  } ) ; 
236242
237-  test ( ' If environment is a conda environment, ensure conda activation command is sent (linux)' ,  async  ( )  =>  { 
238-  const  pythonPath  =  path . join ( 'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'bin' ,  'python' ) ; 
239-  fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  '..' ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
240-  await  expectCondaActivationCommand ( false ,  false ,  true ,  pythonPath ) ; 
241-  } ) ; 
243+    test ( ` If environment is a conda environment, ensure conda activation command is sent for shell  ${ shellType . name }   (linux)` ,  async  ( )  =>  { 
244+    const  pythonPath  =  path . join ( 'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'bin' ,  'python' ) ; 
245+    fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  '..' ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
246+    await  expectCondaActivationCommand ( false ,  false ,  true ,  pythonPath ,   shellType . value ) ; 
247+    } ) ; 
242248
243-  test ( 'If environment is a conda environment, ensure conda activation command is sent (osx)' ,  async  ( )  =>  { 
244-  const  pythonPath  =  path . join ( 'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'bin' ,  'python' ) ; 
245-  fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  '..' ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
246-  await  expectCondaActivationCommand ( false ,  true ,  false ,  pythonPath ) ; 
249+  test ( `If environment is a conda environment, ensure conda activation command is sent for shell ${ shellType . name }  ,  async  ( )  =>  { 
250+  const  pythonPath  =  path . join ( 'users' ,  'xyz' ,  '.conda' ,  'envs' ,  'enva' ,  'bin' ,  'python' ) ; 
251+  fileSystem . setup ( f  =>  f . directoryExists ( TypeMoq . It . isValue ( path . join ( path . dirname ( pythonPath ) ,  '..' ,  'conda-meta' ) ) ) ) . returns ( ( )  =>  Promise . resolve ( true ) ) ; 
252+  await  expectCondaActivationCommand ( false ,  true ,  false ,  pythonPath ,  shellType . value ) ; 
253+  } ) ; 
247254 } ) ; 
248255
249256 test ( 'Get activation script command if environment is not a conda environment' ,  async  ( )  =>  { 
0 commit comments