mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-20 07:35:10 +00:00
Test run proper check for accurate installation
This commit is contained in:
parent
e201cec6d1
commit
1bca1dc5d1
@ -84,6 +84,10 @@ describe('authutil tests', () => {
|
|||||||
await io.mkdirP(fakeSourcesDirForTesting);
|
await io.mkdirP(fakeSourcesDirForTesting);
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await io.rmRF(fakeSourcesDirForTesting);
|
||||||
|
}, 30000);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
if (fs.existsSync(nugetConfigFile)) {
|
if (fs.existsSync(nugetConfigFile)) {
|
||||||
fs.unlinkSync(nugetConfigFile);
|
fs.unlinkSync(nugetConfigFile);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import io = require('@actions/io');
|
import io = require('@actions/io');
|
||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import os = require('os');
|
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import httpClient = require('typed-rest-client/HttpClient');
|
import httpClient = require('typed-rest-client/HttpClient');
|
||||||
|
|
||||||
@ -31,15 +30,13 @@ describe('installer tests', () => {
|
|||||||
|
|
||||||
it('Acquires version of dotnet if no matching version is installed', async () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
await getDotnet('3.1.100');
|
await getDotnet('3.1.100');
|
||||||
const dotnetDir = path.join(toolDir, 'dncs', '3.1.100', os.arch());
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.100'))).toBe(true);
|
||||||
|
|
||||||
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
|
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet.exe'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
}, 30000);
|
}, 100000);
|
||||||
|
|
||||||
it('Throws if no location contains correct dotnet version', async () => {
|
it('Throws if no location contains correct dotnet version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
|
@ -30,8 +30,6 @@ describe('setup-dotnet tests', () => {
|
|||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
it('Acquires version of dotnet if no matching version is installed', async () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
const dotnetDir = path.join(toolDir, 'dncs', '3.1.100', os.arch());
|
|
||||||
|
|
||||||
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
||||||
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.100"${os.EOL}}${os.EOL}}`;
|
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.100"${os.EOL}}${os.EOL}}`;
|
||||||
if (!fs.existsSync(globalJsonPath)) {
|
if (!fs.existsSync(globalJsonPath)) {
|
||||||
@ -39,12 +37,12 @@ describe('setup-dotnet tests', () => {
|
|||||||
}
|
}
|
||||||
await setup.run();
|
await setup.run();
|
||||||
|
|
||||||
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.100'))).toBe(true);
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet.exe'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
fs.unlinkSync(globalJsonPath);
|
fs.unlinkSync(globalJsonPath);
|
||||||
}, 30000);
|
}, 100000);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user