[PR #5829/4c4ef80c backport][stable-6] yarn: Fix state=latest not working with global=true #5992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of PR #5829 as merged into main (4c4ef80).
SUMMARY
Fixes #5712.
_exec
to support running Yarn commands that wouldn't ordinarily be available withyarn global
by setting the working directory to the path fromyarn global dir
instead.list_outdated
to use this new functionality when invokingyarn outdated
.list_outdated
to check for actual errors in stderr output instead of failing on the presence of anything in stderr. This is b/c the Yarn global package.json has no license field, causing a warning to be logged to stderr when invokingyarn outdated
in that directory.Through testing, found a couple more related bugs to fix (see comments below):
DEFAULT_GLOBAL_INSTALLATION_PATH
with code to check the output ofyarn global dir
, as the default path may be different when the use is root, or when the user has set YARN_GLOBAL_FOLDER or the corresponding config flag.list
to function correctly for packages without binaries (regular libraries) when global=true by invokingyarn list
withoutglobal
, the same way I did foryarn outdated
above.And finally, added tests for all the above cases. Previously, there were no tests for
global=true
at all.ISSUE TYPE
COMPONENT NAME
yarn
ADDITIONAL INFORMATION
Before:
After: