Skip to content

Commit b9eea58

Browse files
authored
chore(tests): add test that validates download warning is shown (#370)
1 parent a56c13b commit b9eea58

4 files changed

+18
-0
lines changed

tests/main.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -739,3 +739,21 @@ it(`should support package managers in ESM format`, async () => {
739739
});
740740
});
741741
});
742+
743+
it(`should show a warning on stderr before downloading when enable`, async() => {
744+
await xfs.mktempPromise(async cwd => {
745+
process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT = `1`;
746+
try {
747+
await xfs.writeJsonPromise(ppath.join(cwd, `package.json` as Filename), {
748+
packageManager: `yarn@3.0.0`,
749+
});
750+
await expect(runCli(cwd, [`yarn`, `--version`])).resolves.toMatchObject({
751+
exitCode: 0,
752+
stdout: `3.0.0\n`,
753+
stderr: `Corepack is about to download https://repo.yarnpkg.com/3.0.0/packages/yarnpkg-cli/bin/yarn.js.\n`,
754+
});
755+
} finally {
756+
delete process.env.COREPACK_ENABLE_DOWNLOAD_PROMPT;
757+
}
758+
});
759+
});
4.12 KB
Binary file not shown.
3.78 MB
Binary file not shown.
12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)