mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 13:29:12 +08:00 
			
		
		
		
	add mock for getExecOutput in installer.test.ts
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
				
			|||||||
import * as core from '@actions/core';
 | 
					import * as core from '@actions/core';
 | 
				
			||||||
import * as io from '@actions/io';
 | 
					import * as io from '@actions/io';
 | 
				
			||||||
import * as tc from '@actions/tool-cache';
 | 
					import * as tc from '@actions/tool-cache';
 | 
				
			||||||
 | 
					import * as exec from '@actions/exec';
 | 
				
			||||||
import * as im from '../src/installer';
 | 
					import * as im from '../src/installer';
 | 
				
			||||||
import * as cache from '@actions/cache';
 | 
					import * as cache from '@actions/cache';
 | 
				
			||||||
import fs from 'fs';
 | 
					import fs from 'fs';
 | 
				
			||||||
@@ -38,6 +39,7 @@ describe('setup-node', () => {
 | 
				
			|||||||
  let authSpy: jest.SpyInstance;
 | 
					  let authSpy: jest.SpyInstance;
 | 
				
			||||||
  let parseNodeVersionSpy: jest.SpyInstance;
 | 
					  let parseNodeVersionSpy: jest.SpyInstance;
 | 
				
			||||||
  let isCacheActionAvailable: jest.SpyInstance;
 | 
					  let isCacheActionAvailable: jest.SpyInstance;
 | 
				
			||||||
 | 
					  let getExecOutputSpy: jest.SpyInstance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  beforeEach(() => {
 | 
					  beforeEach(() => {
 | 
				
			||||||
    // @actions/core
 | 
					    // @actions/core
 | 
				
			||||||
@@ -103,6 +105,10 @@ describe('setup-node', () => {
 | 
				
			|||||||
      // uncomment to debug
 | 
					      // uncomment to debug
 | 
				
			||||||
      // process.stderr.write('log:' + line + '\n');
 | 
					      // process.stderr.write('log:' + line + '\n');
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // @actions/exec
 | 
				
			||||||
 | 
					    getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
 | 
				
			||||||
 | 
					    getExecOutputSpy.mockImplementation(() => '16.15.0');
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  afterEach(() => {
 | 
					  afterEach(() => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user