@@ -2,10 +2,12 @@ import * as core from '@actions/core'
2
2
import * as fs from 'fs'
3
3
import * as gitAuthHelper from '../lib/git-auth-helper'
4
4
import * as io from '@actions/io'
5
+ import * as os from 'os'
5
6
import * as path from 'path'
6
7
import { IGitCommandManager } from '../lib/git-command-manager'
7
8
import { IGitSourceSettings } from '../lib/git-source-settings'
8
9
10
+ const isWindows = process . platform === 'win32'
9
11
const testWorkspace = path . join ( __dirname , '_temp' , 'git-auth-helper' )
10
12
const originalRunnerTemp = process . env [ 'RUNNER_TEMP' ]
11
13
const originalHome = process . env [ 'HOME' ]
@@ -22,7 +24,7 @@ describe('git-auth-helper tests', () => {
22
24
beforeAll ( async ( ) => {
23
25
// SSH
24
26
sshPath = await io . which ( 'ssh' )
25
-
27
+
26
28
// Clear test workspace
27
29
await io . rmRF ( testWorkspace )
28
30
} )
@@ -112,7 +114,8 @@ describe('git-auth-helper tests', () => {
112
114
}
113
115
)
114
116
115
- const configureAuth_copiesUserKnownHosts = 'configureAuth copies user known hosts'
117
+ const configureAuth_copiesUserKnownHosts =
118
+ 'configureAuth copies user known hosts'
116
119
it ( configureAuth_copiesUserKnownHosts , async ( ) => {
117
120
if ( ! sshPath ) {
118
121
process . stdout . write (
@@ -210,7 +213,7 @@ describe('git-auth-helper tests', () => {
210
213
)
211
214
212
215
// Asserty git config
213
- const gitConfigLines = ( await fs . promises . readFile ( gitConfigPath ) )
216
+ const gitConfigLines = ( await fs . promises . readFile ( localGitConfigPath ) )
214
217
. toString ( )
215
218
. split ( '\n' )
216
219
. filter ( x => x )
@@ -462,7 +465,7 @@ describe('git-auth-helper tests', () => {
462
465
const authHelper = gitAuthHelper . createAuthHelper ( git , settings )
463
466
await authHelper . configureAuth ( )
464
467
let gitConfigContent = (
465
- await fs . promises . readFile ( gitConfigPath )
468
+ await fs . promises . readFile ( localGitConfigPath )
466
469
) . toString ( )
467
470
expect ( gitConfigContent . indexOf ( 'core.sshCommand' ) ) . toBeGreaterThanOrEqual (
468
471
0
@@ -478,7 +481,7 @@ describe('git-auth-helper tests', () => {
478
481
await authHelper . removeAuth ( )
479
482
480
483
// Assert git config
481
- gitConfigContent = ( await fs . promises . readFile ( gitConfigPath ) ) . toString ( )
484
+ gitConfigContent = ( await fs . promises . readFile ( localGitConfigPath ) ) . toString ( )
482
485
expect ( gitConfigContent . indexOf ( 'core.sshCommand' ) ) . toBeLessThan ( 0 )
483
486
484
487
// Assert SSH key file
@@ -681,4 +684,4 @@ async function getActualSshKnownHostsPath(): Promise<string> {
681
684
expect ( actualTempFiles [ 1 ] . endsWith ( '_known_hosts' ) ) . toBeTruthy ( )
682
685
expect ( actualTempFiles [ 1 ] . startsWith ( actualTempFiles [ 0 ] ) ) . toBeTruthy ( )
683
686
return actualTempFiles [ 1 ]
684
- }
687
+ }
0 commit comments