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

chore: update test to handle case when env var is set #304

Merged
merged 4 commits into from
Sep 4, 2023
Merged
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
5 changes: 5 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ it(`should allow to call "corepack install" without arguments within a configure
});

it(`should refuse to run a different package manager within a configured project`, async () => {
// To ensure we test the default behavior, we must remove these env vars
// in case the local machine already set these values.
delete process.env.COREPACK_ENABLE_STRICT;
delete process.env.FORCE_COLOR;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move it to setupTests.js, to ensure a consistent environment for all tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I pushed an update 👍


await xfs.mktempPromise(async cwd => {
await xfs.writeJsonPromise(ppath.join(cwd, `package.json` as Filename), {
packageManager: `yarn@1.0.0`,
Expand Down