mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 21:04:45 +00:00
feat: install corepack before enabling
This commit is contained in:
parent
dfc689aeba
commit
4c2fa5a76f
4 changed files with 72 additions and 60 deletions
|
@ -288,30 +288,37 @@ describe('main tests', () => {
|
|||
it('should not enable corepack when no input', async () => {
|
||||
inputs['corepack'] = '';
|
||||
await main.run();
|
||||
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(expect.stringContaining('corepack'));
|
||||
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('corepack')
|
||||
);
|
||||
});
|
||||
|
||||
it('should not enable corepack when input is "false"', async () => {
|
||||
inputs['corepack'] = 'false';
|
||||
await main.run();
|
||||
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(expect.stringContaining('corepack'));
|
||||
expect(getCommandOutputSpy).not.toHaveBeenCalledWith(
|
||||
expect.stringContaining('corepack')
|
||||
);
|
||||
});
|
||||
|
||||
it('should enable corepack when input is "true"', async () => {
|
||||
inputs['corepack'] = 'true';
|
||||
await main.run();
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack');
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith('corepack enable');
|
||||
});
|
||||
|
||||
it('should enable corepack with a single package manager', async () => {
|
||||
inputs['corepack'] = 'npm';
|
||||
await main.run();
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack');
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith('corepack enable npm');
|
||||
});
|
||||
|
||||
it('should enable corepack with multiple package managers', async () => {
|
||||
inputs['corepack'] = 'npm yarn';
|
||||
await main.run();
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack');
|
||||
expect(getCommandOutputSpy).toHaveBeenCalledWith(
|
||||
'corepack enable npm yarn'
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue