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

Option to enable corepack #651

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tests: add test to check for corepack enable call
  • Loading branch information
SayakMukhopadhyay committed Dec 26, 2022
commit b6efa7f9037a75d9b7afe041ebd73b12db245bbe
38 changes: 38 additions & 0 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
@@ -1253,6 +1253,44 @@ describe('setup-node', () => {
}
);
});

describe('corepack flag', () => {
it('use corepack if specified', async () => {
inputs['corepack'] = 'true';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable'],
expect.anything()
);
});

it('use corepack with given package manager', async () => {
inputs['corepack'] = 'npm';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm'],
expect.anything()
);
});

it('use corepack with multiple package managers', async () => {
inputs['corepack'] = 'npm yarn';
await main.run();
expect(getExecOutputSpy).toHaveBeenCalledWith(
'corepack',
['enable', 'npm', 'yarn'],
expect.anything()
);
});

it('fails to use corepack with an invalid package manager', async () => {
await expect(im.enableCorepack('npm turbo')).rejects.toThrowError(
`One or more of the specified package managers [ npm turbo ] are not supported by corepack`
);
});
});
});

describe('helper methods', () => {