You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-09-08 05:44:06 +07:00
feat: Cache NuGet global-packages folder (#303)
* feat: cache NuGet global-packages folder * fix: remove unused files * docs: fix incorrect action * ci: add e2e test for cache * docs: accept suggested changes on README * docs: add simple cache example * build: change main script path * fix: change relative path to install scripts * fix: change relative path to problem matcher * refactor: accept changes on cache-utils * fix: revert main script path changes * test: fix cache-utils unit test * test: fix cache-utils unit test * feat: add `cache-dependency-path` variables * build: change main script dist path * ci: add `cache-dependency-path` e2e test & missing lock file * fix: accept change suggestions * ci: copy NuGet lock file to root to pass "test-setup-with-cache" e2e test * docs: change README guide * fix: apply suggestions from code review Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com> * test: fix some failed unit tests - fix `restoreCache()` test for 9703c8 - update installer script * build: rebuild dist * Update unit-tests - Additional unit test were added to setup-dotnet.test.ts * Update unit tests for unix systems * Format and lint unit tests * fix: avoid use '/' on `path.join` * fix: rebuild dist * fix: apply suggestions from code review Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com> * build: add `DisableImplicitNuGetFallbackFolder` option also add guide on README * docs: highlight warnings and notes * docs: update note about handling NU1403 --------- Co-authored-by: Ivan <98037481+IvanZosimov@users.noreply.github.com> Co-authored-by: IvanZosimov <ivanzosimov@github.com>
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import each from 'jest-each';
|
||||
import semver from 'semver';
|
||||
import fs from 'fs';
|
||||
import fspromises from 'fs/promises';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
@ -21,14 +23,25 @@ describe('installer tests', () => {
|
||||
const warningSpy = jest.spyOn(core, 'warning');
|
||||
const whichSpy = jest.spyOn(io, 'which');
|
||||
const maxSatisfyingSpy = jest.spyOn(semver, 'maxSatisfying');
|
||||
const chmodSyncSpy = jest.spyOn(fs, 'chmodSync');
|
||||
const readdirSpy = jest.spyOn(fspromises, 'readdir');
|
||||
|
||||
describe('installDotnet() tests', () => {
|
||||
whichSpy.mockImplementation(() => Promise.resolve('PathToShell'));
|
||||
beforeAll(() => {
|
||||
whichSpy.mockImplementation(() => Promise.resolve('PathToShell'));
|
||||
chmodSyncSpy.mockImplementation(() => {});
|
||||
readdirSpy.mockImplementation(() => Promise.resolve([]));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('should throw the error in case of non-zero exit code of the installation script. The error message should contain logs.', async () => {
|
||||
const inputVersion = '3.1.100';
|
||||
const inputQuality = '' as QualityOptions;
|
||||
const errorMessage = 'fictitious error message!';
|
||||
|
||||
getExecOutputSpy.mockImplementation(() => {
|
||||
return Promise.resolve({
|
||||
exitCode: 1,
|
||||
@ -36,6 +49,7 @@ describe('installer tests', () => {
|
||||
stderr: errorMessage
|
||||
});
|
||||
});
|
||||
|
||||
const dotnetInstaller = new installer.DotnetCoreInstaller(
|
||||
inputVersion,
|
||||
inputQuality
|
||||
|
Reference in New Issue
Block a user