@@ -3,10 +3,10 @@ import * as execAsync from '../../src/functions/exec-async'
33import * as core from '@actions/core'
44import fs from 'fs'
55
6- const infoMock = jest . spyOn ( core , ' info' )
7- const debugMock = jest . spyOn ( core , ' debug' )
8- const setFailedMock = jest . spyOn ( core , ' setFailed' )
9- const warningMock = jest . spyOn ( core , ' warning' )
6+ const infoMock = core . info
7+ const debugMock = core . debug
8+ const setFailedMock = core . setFailed
9+ const warningMock = core . warning
1010
1111function buildGitArgs (
1212 gitOptions = [ '--no-color' , '--full-index' ] ,
@@ -23,13 +23,6 @@ function gitArgvDebug(args) {
2323beforeEach ( ( ) => {
2424 jest . clearAllMocks ( )
2525
26- jest . spyOn ( core , 'saveState' ) . mockImplementation ( ( ) => { } )
27- jest . spyOn ( core , 'debug' ) . mockImplementation ( ( ) => { } )
28- jest . spyOn ( core , 'info' ) . mockImplementation ( ( ) => { } )
29- jest . spyOn ( core , 'setOutput' ) . mockImplementation ( ( ) => { } )
30- jest . spyOn ( core , 'setFailed' ) . mockImplementation ( ( ) => { } )
31- jest . spyOn ( core , 'warning' ) . mockImplementation ( ( ) => { } )
32-
3326 process . env . INPUT_BASE_BRANCH = 'HEAD^1'
3427 process . env . INPUT_SEARCH_PATH = '.'
3528 process . env . INPUT_MAX_BUFFER_SIZE = '1000000'
@@ -237,7 +230,7 @@ test('fails when no custom git diff file is found', async () => {
237230
238231test ( 'executes gitDiff with file_output_only set to true' , async ( ) => {
239232 process . env . INPUT_FILE_OUTPUT_ONLY = 'true'
240- const setOutputMock = jest . spyOn ( core , ' setOutput' )
233+ const setOutputMock = core . setOutput
241234
242235 const results = await gitDiff ( )
243236 expect ( results . files . length ) . toBe ( 5 )
@@ -251,7 +244,7 @@ test('executes gitDiff with file_output_only true and file outputs', async () =>
251244 process . env . INPUT_FILE_OUTPUT_ONLY = 'true'
252245 process . env . INPUT_RAW_DIFF_FILE_OUTPUT = 'test-raw.txt'
253246 process . env . INPUT_JSON_DIFF_FILE_OUTPUT = 'test-json.json'
254- const setOutputMock = jest . spyOn ( core , ' setOutput' )
247+ const setOutputMock = core . setOutput
255248
256249 jest . spyOn ( fs , 'writeFileSync' ) . mockImplementation ( ( ) => {
257250 return true
@@ -845,7 +838,7 @@ test('executes gitDiff with all file outputs and options', async () => {
845838 . mockImplementation ( ( ) => {
846839 return true
847840 } )
848- const setOutputSpy = jest . spyOn ( core , ' setOutput' )
841+ const setOutputSpy = core . setOutput
849842
850843 const results = await gitDiff ( )
851844 expect ( results . files . length ) . toBe ( 5 )
0 commit comments