@@ -72,26 +72,17 @@ describe('pathFind', function () {
7272 assert . strictEqual ( secondResult , 'ssh' )
7373 } )
7474
75- it ( 'only returns valid executable ssh path (CI + Local Non-Windows)' , async function ( ) {
76- // In CI, we can assume Windows machines will have ssh.
77- if ( ! isCI ( ) && isWin ( ) ) {
75+ it ( 'only returns valid executable ssh path (Non-Windows)' , async function ( ) {
76+ if ( isWin ( ) ) {
7877 return
7978 }
80- // On local non-windows, we can overwrite path and create our own executable to find.
81- // On CI windows, we ensure executable exists in first path tried.
82- if ( ! isWin ( ) ) {
83- const workspace = await testutil . createTestWorkspaceFolder ( )
84- const fakeSshPath = path . join ( workspace . uri . fsPath , `ssh` )
85-
86- testutil . setEnv ( testutil . envWithNewPath ( workspace . uri . fsPath ) )
87-
88- await testutil . createExecutableFile ( fakeSshPath , '' )
89- } else {
90- const expectedWindowsPath = 'C:/Windows/System32/OpenSSH/ssh.exe'
91- if ( ! ( await fs . exists ( expectedWindowsPath ) ) ) {
92- await testutil . createExecutableFile ( expectedWindowsPath , '' )
93- }
94- }
79+ // On non-windows, we can overwrite path and create our own executable to find.
80+ const workspace = await testutil . createTestWorkspaceFolder ( )
81+ const fakeSshPath = path . join ( workspace . uri . fsPath , `ssh` )
82+
83+ testutil . setEnv ( testutil . envWithNewPath ( workspace . uri . fsPath ) )
84+
85+ await testutil . createExecutableFile ( fakeSshPath , '' )
9586
9687 const ssh = await findSshPath ( false )
9788 assert . ok ( ssh )
@@ -100,11 +91,10 @@ describe('pathFind', function () {
10091 } )
10192
10293 it ( 'caches result from previous runs (Non-Windows)' , async function ( ) {
103- // In CI, we can assume Windows machines will have ssh.
104- if ( ! isCI ( ) && isWin ( ) ) {
94+ if ( isWin ( ) ) {
10595 return
10696 }
107- // On local non-windows, we can overwrite path and create our own executable to find.
97+ // On non-windows, we can overwrite path and create our own executable to find.
10898 const workspace = await testutil . createTestWorkspaceFolder ( )
10999 // We move the ssh to a temp directory temporarily to test if cache works.
110100 const tempLocation = path . join ( workspace . uri . fsPath , 'temp-ssh' )
@@ -124,5 +114,20 @@ describe('pathFind', function () {
124114
125115 await fs . rename ( tempLocation , ssh1 )
126116 } )
117+
118+ it ( 'finds valid executable path (Windows CI)' , async function ( ) {
119+ // Don't want to be messing with System32 on peoples local machines.
120+ if ( ! isWin ( ) || ! isCI ( ) ) {
121+ return
122+ }
123+ const expectedPathInCI = 'C:/Windows/System32/OpenSSH/ssh.exe'
124+
125+ if ( ! ( await fs . exists ( expectedPathInCI ) ) ) {
126+ await testutil . createExecutableFile ( expectedPathInCI , '' )
127+ }
128+ const ssh = ( await findSshPath ( true ) ) !
129+ const result = await tryRun ( ssh , [ ] )
130+ assert . ok ( result )
131+ } )
127132 } )
128133} )
0 commit comments