Update tests

This commit is contained in:
Uladzimir Havenchyk 2022-08-01 12:03:42 +03:00
parent 8f9fe012e3
commit 2ebb54b081
No known key found for this signature in database
GPG key ID: CAE771D3036BED13
3 changed files with 9 additions and 7 deletions

View file

@ -41,7 +41,6 @@ describe('setup-node', () => {
let parseNodeVersionSpy: jest.SpyInstance; let parseNodeVersionSpy: jest.SpyInstance;
let isCacheActionAvailable: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance;
let execExecSpy: jest.SpyInstance;
beforeEach(() => { beforeEach(() => {
// @actions/core // @actions/core
@ -58,7 +57,6 @@ describe('setup-node', () => {
archSpy = jest.spyOn(osm, 'arch'); archSpy = jest.spyOn(osm, 'arch');
archSpy.mockImplementation(() => os['arch']); archSpy.mockImplementation(() => os['arch']);
execSpy = jest.spyOn(cp, 'execSync'); execSpy = jest.spyOn(cp, 'execSync');
execExecSpy = jest.spyOn(exec, 'exec');
// @actions/tool-cache // @actions/tool-cache
findSpy = jest.spyOn(tc, 'find'); findSpy = jest.spyOn(tc, 'find');
@ -251,18 +249,21 @@ describe('setup-node', () => {
let expPath = path.join(toolPath, 'bin'); let expPath = path.join(toolPath, 'bin');
expect(execExecSpy).toHaveBeenCalledWith('node', ['--version']); expect(getExecOutputSpy).toHaveBeenCalledWith(
expect(execExecSpy).toHaveBeenCalledWith( 'node',
['--version'],
expect.anything()
);
expect(getExecOutputSpy).toHaveBeenCalledWith(
'npm', 'npm',
['--version'], ['--version'],
expect.anything() expect.anything()
); );
expect(execExecSpy).toHaveBeenCalledWith( expect(getExecOutputSpy).toHaveBeenCalledWith(
'yarn', 'yarn',
['--version'], ['--version'],
expect.anything() expect.anything()
); );
expect(dlSpy).toHaveBeenCalled(); expect(dlSpy).toHaveBeenCalled();
expect(exSpy).toHaveBeenCalled(); expect(exSpy).toHaveBeenCalled();
expect(logSpy).toHaveBeenCalledWith( expect(logSpy).toHaveBeenCalledWith(

1
dist/setup/index.js vendored
View file

@ -71906,6 +71906,7 @@ function printEnvDetailsAndSetOutput() {
core.endGroup(); core.endGroup();
}); });
} }
exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
function getToolVersion(tool, options) { function getToolVersion(tool, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {

View file

@ -99,7 +99,7 @@ function resolveVersionInput(): string {
return version; return version;
} }
async function printEnvDetailsAndSetOutput() { export async function printEnvDetailsAndSetOutput() {
core.startGroup('Environment details'); core.startGroup('Environment details');
const promises = ['node', 'npm', 'yarn'].map(async tool => { const promises = ['node', 'npm', 'yarn'].map(async tool => {