Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Tarasovych
Copy link
Contributor

@Tarasovych Tarasovych commented Apr 17, 2020

Fixes TODO

Ref. #940

Copy link
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

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

Thanks!

For now I'd rather see us stick with the IsTerminal helper in utils.

@Tarasovych Tarasovych requested a review from vilmibm April 21, 2020 14:32
Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thank you for updates!

}

func TestPRList(t *testing.T) {
func TestPRList_stdout_is_not_a_tty(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The updated test name makes me think that we should really have a way to force "tty mode" in tests to be able to assert such output. 🤔

This is not something that you have to do in this PR, btw. I don't know yet how would we pass that information to tests.

This comment was marked as spam.

}

eq(t, output.Stderr(), `
Showing 3 of 3 pull requests in OWNER/REPO
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend that we hold off merging this until we figure out how to simulate tty mode for tests so we can keep asserting this output. The header is an important part of output and I wish we can keep test coverage of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is fair. In reviewing #572 and then returning to this I think we need to step back and design a holistic approach to determining what kind of output (both formatting and color) to use; something routed via the cmd reference that can be stubbed appropriately when running commands in a test.

This comment was marked as spam.

command/pr.go Outdated
// TODO: avoid printing header if piped to a script
fmt.Fprintf(colorableErr(cmd), "\n%s\n\n", title)

if utils.IsTerminal(os.Stdout) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using global os.Stdout, we reference the output stream inside commands as cmd.OutOrStdout(), so you should be checking that object instead. This gives us the ability to override the output stream for tests. Note that the output stream is a Writer and not necessarily a File, so you would have to do an additional check.

This comment was marked as spam.

@mislav mislav added the blocked label May 7, 2020
@mislav mislav mentioned this pull request May 20, 2020
11 tasks
@mislav mislav changed the base branch from master to trunk May 27, 2020 11:41
Copy link

@fares378 fares378 left a comment

Choose a reason for hiding this comment

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

Yas

command/pr.go Outdated
// TODO: avoid printing header if piped to a script
fmt.Fprintf(colorableErr(cmd), "\n%s\n\n", title)

if utils.IsTerminal(os.Stdout) {

This comment was marked as spam.

}

eq(t, output.Stderr(), `
Showing 3 of 3 pull requests in OWNER/REPO

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants