Skip to content

Commit

Permalink
chore(tests): add test that validates download warning is shown (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jan 30, 2024
1 parent a56c13b commit b9eea58
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,3 +739,21 @@ it(`should support package managers in ESM format`, async () => {
});
});
});

it(`should show a warning on stderr before downloading when enable`, async() => {
await xfs.mktempPromise(async cwd => {
process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT = `1`;
try {
await xfs.writeJsonPromise(ppath.join(cwd, `package.json` as Filename), {
packageManager: `yarn@3.0.0`,
});
await expect(runCli(cwd, [`yarn`, `--version`])).resolves.toMatchObject({
exitCode: 0,
stdout: `3.0.0\n`,
stderr: `Corepack is about to download https://repo.yarnpkg.com/3.0.0/packages/yarnpkg-cli/bin/yarn.js.\n`,
});
} finally {
delete process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT;
}
});
});
Binary file modified tests/nock/8LXMft4IyEWeaqoiynS5FA-1.dat
Binary file not shown.
Binary file added tests/nock/MuEAzZXT77khPx8FpLSF2A-1.dat
Binary file not shown.
Binary file modified tests/nock/bNE0FYc3WlnFGzjHaIdf5A-1.dat
Binary file not shown.

0 comments on commit b9eea58

Please sign in to comment.