From 2ebb54b081d3c13e858e5152158166af5c7c0e7c Mon Sep 17 00:00:00 2001 From: Uladzimir Havenchyk Date: Mon, 1 Aug 2022 12:03:42 +0300 Subject: [PATCH] Update tests --- __tests__/installer.test.ts | 13 +++++++------ dist/setup/index.js | 1 + src/main.ts | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts index 829ee1f3..e9073a2d 100644 --- a/__tests__/installer.test.ts +++ b/__tests__/installer.test.ts @@ -41,7 +41,6 @@ describe('setup-node', () => { let parseNodeVersionSpy: jest.SpyInstance; let isCacheActionAvailable: jest.SpyInstance; let getExecOutputSpy: jest.SpyInstance; - let execExecSpy: jest.SpyInstance; beforeEach(() => { // @actions/core @@ -58,7 +57,6 @@ describe('setup-node', () => { archSpy = jest.spyOn(osm, 'arch'); archSpy.mockImplementation(() => os['arch']); execSpy = jest.spyOn(cp, 'execSync'); - execExecSpy = jest.spyOn(exec, 'exec'); // @actions/tool-cache findSpy = jest.spyOn(tc, 'find'); @@ -251,18 +249,21 @@ describe('setup-node', () => { let expPath = path.join(toolPath, 'bin'); - expect(execExecSpy).toHaveBeenCalledWith('node', ['--version']); - expect(execExecSpy).toHaveBeenCalledWith( + expect(getExecOutputSpy).toHaveBeenCalledWith( + 'node', + ['--version'], + expect.anything() + ); + expect(getExecOutputSpy).toHaveBeenCalledWith( 'npm', ['--version'], expect.anything() ); - expect(execExecSpy).toHaveBeenCalledWith( + expect(getExecOutputSpy).toHaveBeenCalledWith( 'yarn', ['--version'], expect.anything() ); - expect(dlSpy).toHaveBeenCalled(); expect(exSpy).toHaveBeenCalled(); expect(logSpy).toHaveBeenCalledWith( diff --git a/dist/setup/index.js b/dist/setup/index.js index 9fed4f3a..ebaca417 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -71906,6 +71906,7 @@ function printEnvDetailsAndSetOutput() { core.endGroup(); }); } +exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput; function getToolVersion(tool, options) { return __awaiter(this, void 0, void 0, function* () { try { diff --git a/src/main.ts b/src/main.ts index 8bb0257a..c4f92442 100644 --- a/src/main.ts +++ b/src/main.ts @@ -99,7 +99,7 @@ function resolveVersionInput(): string { return version; } -async function printEnvDetailsAndSetOutput() { +export async function printEnvDetailsAndSetOutput() { core.startGroup('Environment details'); const promises = ['node', 'npm', 'yarn'].map(async tool => {