Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic corepack support for node v14 + #482

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 22 additions & 4 deletions __tests__/installer.test.ts
Expand Up @@ -89,19 +89,19 @@ describe('setup-node', () => {
warningSpy = jest.spyOn(core, 'warning');
cnSpy.mockImplementation(line => {
// uncomment to debug
// process.stderr.write('write:' + line + '\n');
process.stderr.write('write:' + line + '\n');
});
logSpy.mockImplementation(line => {
// uncomment to debug
// process.stderr.write('log:' + line + '\n');
process.stderr.write('log:' + line + '\n');
});
dbgSpy.mockImplementation(msg => {
// uncomment to see debug output
// process.stderr.write(msg + '\n');
process.stderr.write(msg + '\n');
});
warningSpy.mockImplementation(msg => {
// uncomment to debug
// process.stderr.write('log:' + line + '\n');
process.stderr.write('log:' + msg + '\n');
});
});

Expand Down Expand Up @@ -909,4 +909,22 @@ describe('setup-node', () => {
);
});
});

describe('corepack', () => {
it('supports pnpm automatically from Node v14+', async () => {
inputs['node-version'] = '14.19.0';
inputs['cache'] = 'pnpm';

inSpy.mockImplementation(name => inputs[name]);

isCacheActionAvailable.mockImplementation(() => true);

const toolPath = path.normalize('/cache/node/14.19.0/x64');
findSpy.mockReturnValue(toolPath);

await main.run();

expect(cnSpy).toHaveBeenNthCalledWith(2, `[command]${process.execPath.substring(0, process.execPath.length - 4)}corepack enable\n`);
})
})
});