mirror of https://github.com/actions/toolkit
Fix tests
parent
0c58e4113e
commit
62a66a8ce9
|
@ -92,9 +92,9 @@ test('gzip extract tar', async () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('gzip extract GNU tar on windows', async () => {
|
test('gzip extract GNU tar on windows with GNUtar in path', async () => {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
jest.spyOn(fs, 'existsSync').mockReturnValueOnce(false)
|
jest.spyOn(fs, 'existsSync').mockReturnValue(false)
|
||||||
|
|
||||||
const isGnuMock = jest
|
const isGnuMock = jest
|
||||||
.spyOn(utils, 'isGnuTarInstalled')
|
.spyOn(utils, 'isGnuTarInstalled')
|
||||||
|
|
|
@ -119,7 +119,9 @@ export function getCacheFileName(compressionMethod: CompressionMethod): string {
|
||||||
export async function isGnuTarInstalled(): Promise<boolean> {
|
export async function isGnuTarInstalled(): Promise<boolean> {
|
||||||
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe`
|
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe`
|
||||||
const versionOutput = await getVersion('tar')
|
const versionOutput = await getVersion('tar')
|
||||||
return versionOutput.toLowerCase().includes('gnu tar') || fs.existsSync(gnuTar)
|
return (
|
||||||
|
versionOutput.toLowerCase().includes('gnu tar') || fs.existsSync(gnuTar)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assertDefined<T>(name: string, value?: T): T {
|
export function assertDefined<T>(name: string, value?: T): T {
|
||||||
|
|
|
@ -16,6 +16,7 @@ async function getTarPath(
|
||||||
const systemTar = `${process.env['windir']}\\System32\\tar.exe`
|
const systemTar = `${process.env['windir']}\\System32\\tar.exe`
|
||||||
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe`
|
const gnuTar = `${process.env['windir']}\\Program Files\\Git\\usr\\bin\\tar.exe`
|
||||||
if (existsSync(gnuTar)) {
|
if (existsSync(gnuTar)) {
|
||||||
|
// Making GNUtar + zstd as default on windows
|
||||||
args.push('--force-local')
|
args.push('--force-local')
|
||||||
return gnuTar
|
return gnuTar
|
||||||
} else if (compressionMethod !== CompressionMethod.Gzip) {
|
} else if (compressionMethod !== CompressionMethod.Gzip) {
|
||||||
|
|
Loading…
Reference in New Issue