mirror of
https://github.com/actions/setup-node.git
synced 2025-04-22 09:21:00 +00:00
parent
5d43bea6ac
commit
4ae98e59c8
1 changed files with 2 additions and 11 deletions
|
@ -56,7 +56,6 @@ describe('setup-node', () => {
|
||||||
platSpy.mockImplementation(() => os['platform']);
|
platSpy.mockImplementation(() => os['platform']);
|
||||||
archSpy = jest.spyOn(osm, 'arch');
|
archSpy = jest.spyOn(osm, 'arch');
|
||||||
archSpy.mockImplementation(() => os['arch']);
|
archSpy.mockImplementation(() => os['arch']);
|
||||||
execSpy = jest.spyOn(cp, 'execSync');
|
|
||||||
|
|
||||||
// @actions/tool-cache
|
// @actions/tool-cache
|
||||||
findSpy = jest.spyOn(tc, 'find');
|
findSpy = jest.spyOn(tc, 'find');
|
||||||
|
@ -110,6 +109,7 @@ describe('setup-node', () => {
|
||||||
// @actions/exec
|
// @actions/exec
|
||||||
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
getExecOutputSpy = jest.spyOn(exec, 'getExecOutput');
|
||||||
getExecOutputSpy.mockImplementation(() => 'v16.15.0');
|
getExecOutputSpy.mockImplementation(() => 'v16.15.0');
|
||||||
|
execSpy = jest.spyOn(cp, 'execSync');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -397,18 +397,9 @@ describe('setup-node', () => {
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('enables corepack if specified', async () => {
|
it('enables corepack if specified', async () => {
|
||||||
os.platform = 'linux';
|
|
||||||
os.arch = 'x64';
|
|
||||||
|
|
||||||
inputs['node-version'] = '16';
|
|
||||||
inputs['corepack'] = 'true';
|
inputs['corepack'] = 'true';
|
||||||
|
|
||||||
const toolPath = path.normalize('/cache/node/16.17.0/x64');
|
|
||||||
findSpy.mockReturnValue(toolPath);
|
|
||||||
await main.run();
|
await main.run();
|
||||||
|
expect(execSpy).toHaveBeenCalledWith('corepack', ['enable']);
|
||||||
// It seems to call it with the absolute path to corepack, so we easily use `toHaveBeenCalledWith`
|
|
||||||
expect(cnSpy.mock.calls[3][0]).toContain('corepack enable');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('check-latest flag', () => {
|
describe('check-latest flag', () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue