Skip to content

Commit

Permalink
add mock for getExecOutput in installer.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Jun 30, 2022
1 parent adeb189 commit d8b0944
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import * as exec from '@actions/exec';
import * as im from '../src/installer';
import * as cache from '@actions/cache';
import fs from 'fs';
Expand Down Expand Up @@ -38,6 +39,7 @@ describe('setup-node', () => {
let authSpy: jest.SpyInstance;
let parseNodeVersionSpy: jest.SpyInstance;
let isCacheActionAvailable: jest.SpyInstance;
let getExecOutputSpy: jest.SpyInstance;

beforeEach(() => {
// @actions/core
Expand Down Expand Up @@ -103,6 +105,10 @@ describe('setup-node', () => {
// uncomment to debug
// process.stderr.write('log:' + line + '\n');
});

// @actions/exec
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
getExecOutputSpy.mockImplementation(() => '16.15.0');
});

afterEach(() => {
Expand Down

0 comments on commit d8b0944

Please sign in to comment.