|
|
|
@ -7,6 +7,7 @@ const toolDir = path.join(__dirname, 'runner', 'tools2');
|
|
|
|
|
const tempDir = path.join(__dirname, 'runner', 'temp2');
|
|
|
|
|
|
|
|
|
|
import * as setup from '../src/setup-dotnet';
|
|
|
|
|
import * as dotnetInstaller from '../src/installer';
|
|
|
|
|
|
|
|
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
|
|
|
|
|
|
|
@ -19,7 +20,7 @@ describe('setup-dotnet tests', () => {
|
|
|
|
|
await io.rmRF(tempDir);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterAll(async () => {
|
|
|
|
|
afterEach(async () => {
|
|
|
|
|
try {
|
|
|
|
|
await io.rmRF(path.join(process.cwd(), 'global.json'));
|
|
|
|
|
await io.rmRF(toolDir);
|
|
|
|
@ -44,4 +45,26 @@ describe('setup-dotnet tests', () => {
|
|
|
|
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
|
|
|
|
}
|
|
|
|
|
}, 400000);
|
|
|
|
|
|
|
|
|
|
it('Acquires version of dotnet from global.json with rollForward option, install the latest patch', async () => {
|
|
|
|
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
|
|
|
|
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version":"3.1.201",${os.EOL}"rollForward":"latestFeature"${os.EOL}}${os.EOL}}`;
|
|
|
|
|
if (!fs.existsSync(globalJsonPath)) {
|
|
|
|
|
fs.writeFileSync(globalJsonPath, jsonContents);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const version = '3.1';
|
|
|
|
|
const installer = new dotnetInstaller.DotnetCoreInstaller(version);
|
|
|
|
|
const patchVersion = await installer.resolveVersion(
|
|
|
|
|
new dotnetInstaller.DotNetVersionInfo(version)
|
|
|
|
|
);
|
|
|
|
|
await setup.run();
|
|
|
|
|
|
|
|
|
|
expect(fs.existsSync(path.join(toolDir, 'sdk', patchVersion))).toBe(true);
|
|
|
|
|
if (IS_WINDOWS) {
|
|
|
|
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
|
|
|
|
} else {
|
|
|
|
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
|
|
|
|
}
|
|
|
|
|
}, 400000);
|
|
|
|
|
});
|
|
|
|
|