mirror of
https://gitea.com/actions/setup-node.git
synced 2024-11-25 11:39:32 +01:00
Mock fs.existsSync in tests
This commit is contained in:
parent
0453e516eb
commit
e93556ca66
1 changed files with 5 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import * as utils from '../src/cache-utils';
|
import * as utils from '../src/cache-utils';
|
||||||
|
@ -28,6 +29,7 @@ describe('run', () => {
|
||||||
let saveCacheSpy: jest.SpyInstance;
|
let saveCacheSpy: jest.SpyInstance;
|
||||||
let getCommandOutputSpy: jest.SpyInstance;
|
let getCommandOutputSpy: jest.SpyInstance;
|
||||||
let hashFilesSpy: jest.SpyInstance;
|
let hashFilesSpy: jest.SpyInstance;
|
||||||
|
let existsSpy: jest.SpyInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
getInputSpy = jest.spyOn(core, 'getInput');
|
getInputSpy = jest.spyOn(core, 'getInput');
|
||||||
|
@ -63,6 +65,9 @@ describe('run', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
existsSpy = jest.spyOn(fs, 'existsSync');
|
||||||
|
existsSpy.mockImplementation(() => true);
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
|
getCommandOutputSpy = jest.spyOn(utils, 'getCommandOutput');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue