Skip to content

Commit d8b0944

Browse files
committed
add mock for getExecOutput in installer.test.ts
1 parent adeb189 commit d8b0944

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

__tests__/installer.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as core from '@actions/core';
22
import * as io from '@actions/io';
33
import * as tc from '@actions/tool-cache';
4+
import * as exec from '@actions/exec';
45
import * as im from '../src/installer';
56
import * as cache from '@actions/cache';
67
import fs from 'fs';
@@ -38,6 +39,7 @@ describe('setup-node', () => {
3839
let authSpy: jest.SpyInstance;
3940
let parseNodeVersionSpy: jest.SpyInstance;
4041
let isCacheActionAvailable: jest.SpyInstance;
42+
let getExecOutputSpy: jest.SpyInstance;
4143

4244
beforeEach(() => {
4345
// @actions/core
@@ -103,6 +105,10 @@ describe('setup-node', () => {
103105
// uncomment to debug
104106
// process.stderr.write('log:' + line + '\n');
105107
});
108+
109+
// @actions/exec
110+
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
111+
getExecOutputSpy.mockImplementation(() => '16.15.0');
106112
});
107113

108114
afterEach(() => {

0 commit comments

Comments
 (0)