feat: allow specifying a version

This commit is contained in:
Jacob Parish 2025-03-25 11:13:23 -05:00
parent 4478bd4702
commit aa9724272b
6 changed files with 40 additions and 6 deletions

View file

@ -301,10 +301,28 @@ describe('main tests', () => {
);
});
it('should enable corepack when input is "true"', async () => {
it('should install latest corepack when input is "true"', async () => {
inputs['corepack'] = 'true';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith('npm i -g corepack');
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@latest'
);
});
it('should install latest corepack when input is "latest"', async () => {
inputs['corepack'] = 'latest';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@latest'
);
});
it('should install a specific version of corepack when specified', async () => {
inputs['corepack'] = '0.32.0';
await main.run();
expect(getCommandOutputSpy).toHaveBeenCalledWith(
'npm i -g corepack@0.32.0'
);
});
});
});