Skip to content
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

fix(console-reporter): Fix issue where tree logger was ignoring --silent/-s flag #5722

Merged
merged 3 commits into from
Apr 26, 2018

Conversation

jxom
Copy link
Contributor

@jxom jxom commented Apr 24, 2018

Summary

This PR fixes #5721 where upgrade was not being silent when the --silent/-s flags were provided. It still printed the tree. 🖨🌳

Test plan

Added two new test cases.

Manual CLI tests:

Before:

> yarn-local upgrade --silent
└─ left-pad@1.3.0
└─ left-pad@1.3.0

After:

> yarn-local upgrade --silent

@jxom
Copy link
Contributor Author

jxom commented Apr 24, 2018

cc/ @rally25rs

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the patch! Can you add tests for this fix here: https://github.com/yarnpkg/yarn/blob/master/__tests__/reporters/console-reporter.js?

@rally25rs
Copy link
Contributor

To add a test for silent you'll have to add a way to pass options into __tests__/reporters/_mock.js so that you can pass down a silent: true flag to the reporter constructor.

I can lend a hand with that if needed.

@jxom
Copy link
Contributor Author

jxom commented Apr 25, 2018

@BYK @rally25rs - can you take a look at those changes?

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@@ -16,7 +16,8 @@ type MockCallback = (reporter: Reporter, opts: Object) => ?Promise<void>;
export default function<T>(
Reporter: Function,
interceptor: Interceptor<T>,
prepare?: (reporter: Reporter) => any,
prepare?: ?(reporter: Reporter) => any,
opts?: Object,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this can be extraOpts and then you can avoid the opts -> newOpts rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was thinking that too. But thought it would have been preferred to keep the argument named as opts. Let me know if you want to change though 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, already merged :D

@@ -266,3 +266,41 @@ test('close', async () => {
}),
).toMatchSnapshot();
});

test('ConsoleReporter.log is silent when isSilent is true', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the 'ConsoleReporter.' prefix please :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch that, just realized the whole file does this.

@BYK BYK changed the title Fix issue where tree logger was ignoring --silent/-s flag fix(console-reporter): Fix issue where tree logger was ignoring --silent/-s flag Apr 26, 2018
@BYK BYK merged commit 8bf8eb0 into yarnpkg:master Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--silent / -s not working for upgrade
3 participants