From 98a40695580ff2ec9783455362f514662deaf0bc Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Wed, 17 Aug 2022 08:21:09 +0000 Subject: [PATCH] Fix failing test cases on windows --- packages/cache/__tests__/tar.test.ts | 8 ++++---- packages/cache/src/internal/tar.ts | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/cache/__tests__/tar.test.ts b/packages/cache/__tests__/tar.test.ts index b05c67e1..e4233bc9 100644 --- a/packages/cache/__tests__/tar.test.ts +++ b/packages/cache/__tests__/tar.test.ts @@ -50,7 +50,7 @@ test('zstd extract tar', async () => { `"${defaultTarPath}"`, [ '--use-compress-program', - 'unzstd --long=30', + IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30', '-xf', IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath, '-P', @@ -140,7 +140,7 @@ test('zstd create tar', async () => { [ '--posix', '--use-compress-program', - 'zstdmt --long=30', + IS_WINDOWS ? 'zstd -T0 --long=30' : 'zstdmt --long=30', '-cf', IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, '--exclude', @@ -210,7 +210,7 @@ test('zstd list tar', async () => { `"${defaultTarPath}"`, [ '--use-compress-program', - 'unzstd --long=30', + IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30', '-tf', IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath, '-P' @@ -235,7 +235,7 @@ test('zstdWithoutLong list tar', async () => { `"${defaultTarPath}"`, [ '--use-compress-program', - 'unzstd', + IS_WINDOWS ? 'zstd -d' : 'unzstd', '-tf', IS_WINDOWS ? archivePath.replace(/\\/g, '/') : archivePath, '-P' diff --git a/packages/cache/src/internal/tar.ts b/packages/cache/src/internal/tar.ts index 07335774..cb563a0a 100644 --- a/packages/cache/src/internal/tar.ts +++ b/packages/cache/src/internal/tar.ts @@ -69,12 +69,12 @@ export async function extractTar( switch (compressionMethod) { case CompressionMethod.Zstd: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -d --long=30'] + return ['--use-compress-program', 'zstd -d --long=30'] } return ['--use-compress-program', 'unzstd --long=30'] case CompressionMethod.ZstdWithoutLong: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -d'] + return ['--use-compress-program', 'zstd -d'] } return ['--use-compress-program', 'unzstd'] default: @@ -115,12 +115,12 @@ export async function createTar( switch (compressionMethod) { case CompressionMethod.Zstd: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -T0 --long=30'] + return ['--use-compress-program', 'zstd -T0 --long=30'] } return ['--use-compress-program', 'zstdmt --long=30'] case CompressionMethod.ZstdWithoutLong: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -T0'] + return ['--use-compress-program', 'zstd -T0'] } return ['--use-compress-program', 'zstdmt'] default: @@ -156,12 +156,12 @@ export async function listTar( switch (compressionMethod) { case CompressionMethod.Zstd: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -d --long=30'] + return ['--use-compress-program', 'zstd -d --long=30'] } return ['--use-compress-program', 'unzstd --long=30'] case CompressionMethod.ZstdWithoutLong: if (process.platform === 'win32') { - return ['--use-compress-program=zstd -d'] + return ['--use-compress-program', 'zstd -d'] } return ['--use-compress-program', 'unzstd'] default: