mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2025-01-14 02:18:07 +08:00
fix
This commit is contained in:
parent
8bb494502e
commit
3ad33f1c8c
5
.github/workflows/workflow.yml
vendored
5
.github/workflows/workflow.yml
vendored
@ -16,6 +16,11 @@ jobs:
|
||||
with:
|
||||
version: 12.x
|
||||
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 12.0.2
|
||||
|
||||
- name: npm install
|
||||
run: npm install
|
||||
|
||||
|
@ -48,6 +48,7 @@ describe('leiningen tests', () => {
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true);
|
||||
await exec.exec('lein version');
|
||||
}, 100000);
|
||||
|
||||
it('Uses version of leiningen installed in cache', async () => {
|
||||
|
@ -1,82 +1,83 @@
|
||||
import io = require('@actions/io');
|
||||
import exec = require('@actions/exec');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'tdeps');
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'tdeps');
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
import * as tdeps from '../src/tdeps';
|
||||
|
||||
describe('tdeps tests', () => {
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 300000);
|
||||
beforeAll(async () => {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
}, 300000);
|
||||
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
}
|
||||
}, 100000);
|
||||
afterAll(async () => {
|
||||
try {
|
||||
await io.rmRF(toolDir);
|
||||
await io.rmRF(tempDir);
|
||||
} catch {
|
||||
console.log('Failed to remove test directories');
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
it('Throws if invalid version', async () => {
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
});
|
||||
|
||||
it('Install clojure tools deps with normal version', async () => {
|
||||
await tdeps.setup('1.10.1.469');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
it('Install clojure tools deps with normal version', async () => {
|
||||
await tdeps.setup('1.10.1.469');
|
||||
const clojureDir = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
||||
}, 100000);
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
||||
exec.exec('clj -Sdescribe');
|
||||
}, 100000);
|
||||
|
||||
it('Uses version of clojure tools-deps installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||
await tdeps.setup('1.10.1.469');
|
||||
return;
|
||||
});
|
||||
it('Uses version of clojure tools-deps installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||
await tdeps.setup('1.10.1.469');
|
||||
return;
|
||||
});
|
||||
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||
const clojureDir: string = path.join(
|
||||
toolDir,
|
||||
'ClojureToolsDeps',
|
||||
'1.10.1-469',
|
||||
os.arch()
|
||||
);
|
||||
await io.mkdirP(clojureDir);
|
||||
let thrown = false;
|
||||
try {
|
||||
await tdeps.setup('1000');
|
||||
} catch {
|
||||
thrown = true;
|
||||
}
|
||||
expect(thrown).toBe(true);
|
||||
return;
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user