Cleanup: not using tempDir
This commit is contained in:
@@ -4,24 +4,21 @@ import os = require('os');
|
|||||||
import path = require('path');
|
import path = require('path');
|
||||||
|
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
const tempDir = path.join(__dirname, 'runner', 'temp');
|
|
||||||
|
|
||||||
process.env['AGENT_TOOLSDIRECTORY'] = toolDir;
|
process.env['AGENT_TOOLSDIRECTORY'] = toolDir;
|
||||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||||
process.env['RUNNER_TEMP'] = tempDir;
|
|
||||||
|
|
||||||
import {findHaskellGHCVersion, findHaskellCabalVersion} from '../src/installer';
|
import {findHaskellGHCVersion, findHaskellCabalVersion} from '../src/installer';
|
||||||
|
|
||||||
describe('find-haskell', () => {
|
describe('find-haskell', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
await io.rmRF(toolDir);
|
await io.rmRF(toolDir);
|
||||||
await io.rmRF(tempDir);
|
|
||||||
|
|
||||||
const ghcDir: string = path.join(tempDir, 'ghc', '8.6.5', 'bin');
|
const ghcDir: string = path.join(toolDir, 'ghc', '8.6.5', 'bin');
|
||||||
await io.mkdirP(ghcDir);
|
await io.mkdirP(ghcDir);
|
||||||
fs.writeFileSync(`${ghcDir}.complete`, 'hello');
|
fs.writeFileSync(`${ghcDir}.complete`, 'hello');
|
||||||
|
|
||||||
const cabalDir: string = path.join(tempDir, 'cabal', '2.0', 'bin');
|
const cabalDir: string = path.join(toolDir, 'cabal', '2.0', 'bin');
|
||||||
await io.mkdirP(cabalDir);
|
await io.mkdirP(cabalDir);
|
||||||
fs.writeFileSync(`${cabalDir}.complete`, 'hello');
|
fs.writeFileSync(`${cabalDir}.complete`, 'hello');
|
||||||
});
|
});
|
||||||
@@ -29,7 +26,6 @@ describe('find-haskell', () => {
|
|||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
try {
|
try {
|
||||||
await io.rmRF(toolDir);
|
await io.rmRF(toolDir);
|
||||||
await io.rmRF(tempDir);
|
|
||||||
} catch {
|
} catch {
|
||||||
console.log('Failed to remove test directories');
|
console.log('Failed to remove test directories');
|
||||||
}
|
}
|
||||||
@@ -37,18 +33,18 @@ describe('find-haskell', () => {
|
|||||||
|
|
||||||
it('Uses version of ghc installed in cache', async () => {
|
it('Uses version of ghc installed in cache', async () => {
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||||
await findHaskellGHCVersion(tempDir, '8.6.5');
|
await findHaskellGHCVersion(toolDir, '8.6.5');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Uses version of cabal installed in cache', async () => {
|
it('Uses version of cabal installed in cache', async () => {
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
// This will throw if it doesn't find it in the cache (because no such version exists)
|
||||||
await findHaskellCabalVersion(tempDir, '2.0');
|
await findHaskellCabalVersion(toolDir, '2.0');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('findHaskellGHCVersion throws if cannot find any version of ghc', async () => {
|
it('findHaskellGHCVersion throws if cannot find any version of ghc', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await findHaskellGHCVersion(tempDir, '9.9.9');
|
await findHaskellGHCVersion(toolDir, '9.9.9');
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
@@ -58,7 +54,7 @@ describe('find-haskell', () => {
|
|||||||
it('findHaskellCabalVersion throws if cannot find any version of ghc', async () => {
|
it('findHaskellCabalVersion throws if cannot find any version of ghc', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await findHaskellCabalVersion(tempDir, '9.9.9');
|
await findHaskellCabalVersion(toolDir, '9.9.9');
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user