yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.35k stars 1.1k forks source link

[Bug] Installing older versions of @yarnpkg/cli yields warnings #2165

Open bgotink opened 3 years ago

bgotink commented 3 years ago

Describe the bug

@yarnpkg/cli has ^ dependencies on yarn plugin packages, which in turn have peer dependencies on @yarnpkg/cli. Installing @yarnpkg/cli version 2.2 in a repo yields

➤ YN0000: ┌ Resolution step
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-dlx@npm:2.1.3
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-essentials@npm:2.3.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-init@npm:2.2.1
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.3 requested by @yarnpkg/plugin-node-modules@npm:2.2.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-npm-cli@npm:2.2.0
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pack@npm:2.2.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-patch@npm:2.1.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.0 [c3248] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pnp@npm:2.3.1
➤ YN0060: │ @yarnpkg/plugin-node-modules@npm:2.2.2 [0e7f4] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pnp@npm:2.3.1
➤ YN0060: │ @yarnpkg/plugin-pnp@npm:2.3.1 [0e7f4] provides @yarnpkg/cli@npm:2.2.0 [c3248] with version 2.2.0 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-stage@npm:2.1.2
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 227ms
➤ YN0000: Done with warnings in 0s 388ms

To Reproduce

yarn add @yarnpkg/cli@2.2
Reproduction ```js repro await packageJsonAndInstall({}); const output = await yarn(`add`, `@yarnpkg/cli@2.2.2`); expect(output).not.toContain(`with version 2.2.2 which doesn't satisfy`); ```
yarnbot commented 3 years ago

The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):

Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js add @yarnpkg/cli@2.2

Usage Error: No project found in /tmp/tmp-20jfIOyH1M102o

$ yarn add [--json] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] ...

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy(). If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow().

yarnbot commented 3 years ago

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot commented 3 years ago

This issue reproduces on master:

Error: expect(received).not.toContain(expected) // indexOf

Expected substring: not "with version 2.2.2 which doesn't satisfy"
Received string:        "➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-dlx@npm:2.1.3
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-essentials@npm:2.3.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-init@npm:2.2.1
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.3 requested by @yarnpkg/plugin-node-modules@npm:2.2.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-npm-cli@npm:2.2.0
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pack@npm:2.2.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-patch@npm:2.1.2
➤ YN0060: │ @yarnpkg/cli@npm:2.2.2 [dc3fc] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pnp@npm:2.3.1
➤ YN0060: │ @yarnpkg/plugin-node-modules@npm:2.2.2 [46912] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.2 requested by @yarnpkg/plugin-pnp@npm:2.3.1
➤ YN0060: │ @yarnpkg/plugin-pnp@npm:2.3.1 [46912] provides @yarnpkg/cli@npm:2.2.2 [dc3fc] with version 2.2.2 which doesn't satisfy ^2.3.0 requested by @yarnpkg/plugin-stage@npm:2.1.2
::endgroup::
➤ YN0000: └ Completed in 4s 96ms
➤ YN0000: ┌ Fetch step
::group::Fetch step
➤ YN0013: │ No packages were cached - 179 packages had to be fetched
::endgroup::
➤ YN0000: └ Completed in 4s 313ms
➤ YN0000: ┌ Link step
::group::Link step
::endgroup::
➤ YN0000: └ Completed in 0s 390ms
➤ YN0000: Done with warnings in 8s 846ms
"
    at module.exports (evalmachine.<anonymous>:5:20)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)