From 5a0405df4e20ef2d43a1b9b4412a788892a2c91e Mon Sep 17 00:00:00 2001 From: Sampark Sharma Date: Tue, 15 Nov 2022 08:48:29 +0000 Subject: [PATCH] Fix tests --- packages/cache/__tests__/tar.test.ts | 2 +- packages/cache/src/internal/constants.ts | 2 +- packages/cache/src/internal/tar.ts | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/cache/__tests__/tar.test.ts b/packages/cache/__tests__/tar.test.ts index 61338bc3..31f9bd5e 100644 --- a/packages/cache/__tests__/tar.test.ts +++ b/packages/cache/__tests__/tar.test.ts @@ -106,7 +106,7 @@ test('gzip extract GNU tar on windows with GNUtar in path', async () => { // GNU tar present in path but not at default location const isGnuMock = jest .spyOn(utils, 'getGnuTarPathOnWindows') - .mockReturnValue(Promise.resolve('C:\\Program Files\\gnutar\\tar.exe')) + .mockReturnValue(Promise.resolve('tar')) const execMock = jest.spyOn(exec, 'exec') const archivePath = `${process.env['windir']}\\fakepath\\cache.tar` const workspace = process.env['GITHUB_WORKSPACE'] diff --git a/packages/cache/src/internal/constants.ts b/packages/cache/src/internal/constants.ts index cc58a0b6..f4da6e6d 100644 --- a/packages/cache/src/internal/constants.ts +++ b/packages/cache/src/internal/constants.ts @@ -23,4 +23,4 @@ export const DefaultRetryDelay = 5000 export const SocketTimeout = 5000 // The default path of GNUtar on hosted Windows runners -export const GnuTarPathOnWindows = 'C:\\Program Files\\Git\\usr\\bin\\tar.exe' \ No newline at end of file +export const GnuTarPathOnWindows = 'C:\\Program Files\\Git\\usr\\bin\\tar.exe' diff --git a/packages/cache/src/internal/tar.ts b/packages/cache/src/internal/tar.ts index db2f635a..b1921613 100644 --- a/packages/cache/src/internal/tar.ts +++ b/packages/cache/src/internal/tar.ts @@ -7,10 +7,7 @@ import {CompressionMethod} from './constants' const IS_WINDOWS = process.platform === 'win32' -async function getTarPath( - args: string[], - compressionMethod: CompressionMethod -): Promise { +async function getTarPath(args: string[]): Promise { let tarPath = await io.which('tar', true) switch (process.platform) { case 'win32': {