diff --git a/tests/main.test.ts b/tests/main.test.ts index 9011721f0..e306acc89 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -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; + } + }); +}); diff --git a/tests/nock/8LXMft4IyEWeaqoiynS5FA-1.dat b/tests/nock/8LXMft4IyEWeaqoiynS5FA-1.dat index 242f7f5fb..b972abaee 100644 Binary files a/tests/nock/8LXMft4IyEWeaqoiynS5FA-1.dat and b/tests/nock/8LXMft4IyEWeaqoiynS5FA-1.dat differ diff --git a/tests/nock/MuEAzZXT77khPx8FpLSF2A-1.dat b/tests/nock/MuEAzZXT77khPx8FpLSF2A-1.dat new file mode 100644 index 000000000..348d2efab Binary files /dev/null and b/tests/nock/MuEAzZXT77khPx8FpLSF2A-1.dat differ diff --git a/tests/nock/bNE0FYc3WlnFGzjHaIdf5A-1.dat b/tests/nock/bNE0FYc3WlnFGzjHaIdf5A-1.dat index fde1530ed..3d988086e 100644 Binary files a/tests/nock/bNE0FYc3WlnFGzjHaIdf5A-1.dat and b/tests/nock/bNE0FYc3WlnFGzjHaIdf5A-1.dat differ