From 7eefc6eb215d2c70b5fe6aa4ad8dec8e6fcc1d71 Mon Sep 17 00:00:00 2001 From: Sergey Dolin Date: Wed, 12 Jul 2023 02:14:56 +0200 Subject: [PATCH] Fix unit tests --- .github/workflows/windows-validation.yml | 2 +- __tests__/windows-performance.test.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-validation.yml b/.github/workflows/windows-validation.yml index 93bce4f65..91e6e5f2c 100644 --- a/.github/workflows/windows-validation.yml +++ b/.github/workflows/windows-validation.yml @@ -29,7 +29,7 @@ jobs: - run: | du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t') - # make sure archive does not take lost of the space + # make sure archive does not take lot of space if [ $size -gt 999 ];then echo 'Size of installed on drive d: go is too big'; exit 1 diff --git a/__tests__/windows-performance.test.ts b/__tests__/windows-performance.test.ts index 7e7f18ebf..451744b67 100644 --- a/__tests__/windows-performance.test.ts +++ b/__tests__/windows-performance.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import * as io from '@actions/io'; import {addExecutablesToCache, IGoVersionInfo} from '../src/installer'; +import path from 'path'; describe('Windows performance workaround', () => { let mkdirSpy: jest.SpyInstance; @@ -52,10 +53,14 @@ describe('Windows performance workaround', () => { process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache1'; const cacheDir1 = await addExecutablesToCache('/qzx', info, 'arch'); - expect(cacheDir1).toBe('/faked-hostedtoolcache1/go/1.2.3/arch'); + expect(cacheDir1).toBe( + path.join('/', 'faked-hostedtoolcache1', 'go', '1.2.3', 'arch') + ); process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache2'; const cacheDir2 = await addExecutablesToCache('/qzx', info, 'arch'); - expect(cacheDir2).toBe('/faked-hostedtoolcache2/go/1.2.3/arch'); + expect(cacheDir2).toBe( + path.join('/', 'faked-hostedtoolcache2', 'go', '1.2.3', 'arch') + ); }); });