-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yarn config respect --no-defaults with --json (fixes #6341) #6635
base: master
Are you sure you want to change the base?
Conversation
As documented here https://yarnpkg.com/cli/config you would expect `--no-defaults` to omit defaults even when `--json` is also specified. This commit fixes that behaviour to be as expected.
That looks good to me; can you also add a test to prevent regressions? |
For something like this you'd set both plugin-essentials and cli to |
Re tests it seems https://github.com/yarnpkg/berry/blob/master/packages/acceptance-tests/pkg-tests-specs/sources/commands/config.test.ts is the right place though AFAICS there is no test for |
Trying to run Console output
EDIT: ah sorry, I hadn't yet run |
This is all new to me but these choices are based on: yarnpkg#6635 (comment)
This is all new to me but these choices are based on: yarnpkg#6635 (comment)
Squashed from several commits while figuring out what was going on: Remove unnecessary replacements Back in 7835a7d there was no `FILTER` at the top but now that there is, these settings are not in the output. Remove confusing cleanupJsonOutput method This does not support ndjson so in all tests (prior to this PR) it was failing to parse the JSON and not actually executing most of the method body. Now that one of the new tests returns only a single line of JSON this 'resurrected' this dead broken method causing tests to fail. Instead use the same cleanup method for all cases, which is what has been happening anyway (due to the fallback in the `catch`) Add the remaining to snapshots now the tests are fixed
@arcanis hopefully I've done the right thing with committing that releases file. The tests were gnarly because there was a bunch of dead code which was 'resurrected' by adding a test which returned a single json line - hopefully the commit message explains it sufficiently (!) |
The 2 CI failures look unrelated, are they a known issue? |
What's the problem this PR addresses?
As documented here https://yarnpkg.com/cli/config you would expect
--no-defaults
to omit defaults even when--json
is also specified.This PR resolves #6341
How did you fix it?
By respecting
noDefaults
in theif (this.json) {
branch as well as theelse
Checklist