cleanup temp dir after each test when installing buildx

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-02-17 20:00:56 +01:00
parent 2abe456e6b
commit 12e3bd7469
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7

View File

@ -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) => {