Skip to content

Ensure git operations preserve their stderr in error output#47

Merged
mislav merged 6 commits intomasterfrom
exec-cmd-error-info
Nov 6, 2019
Merged

Ensure git operations preserve their stderr in error output#47
mislav merged 6 commits intomasterfrom
exec-cmd-error-info

Conversation

@mislav
Copy link
Copy Markdown
Contributor

@mislav mislav commented Nov 1, 2019

This, for instance, ensures that running a gh command outside of a git repository will include the following error when trying to access a git repository:

$ gh pr list
fatal: not a git repository (or any of the parent directories): .git
git: exit status 128

Previously, the output was just exit status 128, which wasn't enough to determine the cause of the failure.

This also provides a SetPrepareCmd hook for tests to be able to define stubs for commands that are supposed to be run.

The SetPrepareCmd hook us then used to spy on OpenInBrowser, so that we don't have to maintain a separate mechanism for testing that URLs were opened in a browser.

This also provides a SetPrepareCmd hook for tests to be able to define stubs for commands that are supposed to be run
We are now able to assert that the browse command was called with the correct URL
Copy link
Copy Markdown
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.

I'm guessing we should use this testing approach instead of the TestHelperProcess thing I put in the pr-create branch?

@mislav
Copy link
Copy Markdown
Contributor Author

mislav commented Nov 6, 2019

@vilmibm This might be an easier way to quickly stub output from one command e.g. git status, however I'm not yet clear how would we handle a test case when multiple commands are executed. The TestHelperProcess approach can potentially parse flags and arguments and handle dispatch of stubs in tests, so it might be more versatile. I'm inclined to keep both and see which one feels better over time 👍

@mislav mislav merged commit 685761e into master Nov 6, 2019
@mislav mislav deleted the exec-cmd-error-info branch November 6, 2019 18:45
vilmibm pushed a commit that referenced this pull request Jun 29, 2021
Updated browse tests for Test_runBrowse and TestNewCmdBrowse
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.

2 participants