From 3af5b19a9810781e980e387325aab3a700e6cd96 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Fri, 7 Jun 2019 17:30:33 -0400 Subject: [PATCH] Randomize folder for concurrent builds --- __tests__/installer.test.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index a1495078..3ae4e182 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -3,8 +3,26 @@ import fs = require('fs'); import os = require('os'); import path = require('path'); -const toolDir = path.join(process.cwd(), 'runner', 'tools'); -const tempDir = path.join(process.cwd(), 'runner', 'temp'); +const toolDir = path.join( + process.cwd(), + 'runner', + path.join( + Math.random() + .toString(36) + .substring(7) + ), + 'tools' +); +const tempDir = path.join( + process.cwd(), + 'runner', + path.join( + Math.random() + .toString(36) + .substring(7) + ), + 'temp' +); process.env['RUNNER_TOOLSDIRECTORY'] = toolDir; process.env['RUNNER_TEMPDIRECTORY'] = tempDir; @@ -18,6 +36,11 @@ describe('installer tests', () => { await io.rmRF(tempDir); }, 100000); + afterAll(async () => { + await io.rmRF(toolDir); + await io.rmRF(tempDir); + }, 100000); + it('Acquires version of node if no matching version is installed', async () => { await installer.getNode('10.16.0'); const nodeDir = path.join(toolDir, 'node', '10.16.0', os.arch());