From 12e3bd74692be3a5d4d6c2bd010531e1de8a0e09 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 17 Feb 2023 20:00:56 +0100 Subject: [PATCH] cleanup temp dir after each test when installing buildx Signed-off-by: CrazyMax --- __tests__/buildx/install.test.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/__tests__/buildx/install.test.ts b/__tests__/buildx/install.test.ts index 20a6dfb..776a129 100644 --- a/__tests__/buildx/install.test.ts +++ b/__tests__/buildx/install.test.ts @@ -14,26 +14,31 @@ * limitations under the License. */ -import {describe, expect, it, jest, test, beforeEach} from '@jest/globals'; +import {describe, expect, it, jest, test, beforeEach, afterEach} from '@jest/globals'; import * as fs from 'fs'; import * as path from 'path'; +import * as rimraf from 'rimraf'; import osm = require('os'); import {Install} from '../../src/buildx/install'; +// prettier-ignore +const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-jest').split(path.sep).join(path.posix.sep); + beforeEach(() => { jest.clearAllMocks(); }); +afterEach(function () { + rimraf.sync(tmpDir); +}); + describe('install', () => { - // prettier-ignore - const tmpDir = path.join(process.env.TEMP || '/tmp', 'buildx-install-jest').split(path.sep).join(path.posix.sep); - // prettier-ignore test.each([ - ['v0.4.1', false], + ['v0.9.1', false], ['latest', false], - ['v0.4.1', true], + ['v0.9.1', true], ['latest', true] ])( 'acquires %p of buildx (standalone: %p)', async (version, standalone) => {