Skip to content

Commit 78faa55

Browse files
Merge pull request #534 from panva/set-version-output
set node-version output (2022 edition)
2 parents 0f15a51 + 460f886 commit 78faa55

File tree

5 files changed

+939
-918
lines changed

5 files changed

+939
-918
lines changed

__tests__/installer.test.ts

+6
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(() => 'v16.15.0');
106112
});
107113

108114
afterEach(() => {

action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ inputs:
3030
outputs:
3131
cache-hit:
3232
description: 'A boolean value to indicate if a cache was hit.'
33+
node-version:
34+
description: 'The installed node version.'
3335
runs:
3436
using: 'node16'
3537
main: 'dist/setup/index.js'

0 commit comments

Comments
 (0)