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

[cli] Add outputBuffer getter and mutable isTTY for tests #6827

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Oct 12, 2021

These changes related to CLI tests arer originally from #6652, but pulled out to be merged separately.

  • outputBuffer is a simpler way of asserting tests against the CLI output instead of working directly withe Jest mock function.
  • output.isTTY is also now mutable, so that we can write tests for both cases when the output is different based on TTY-ness (for example, see the updated vc whoami tests in this PR).

These changes originally from #6652, but pulled out to be merged
separately.

`outputBuffer` is a simpler way of asserting tests against the CLI
output instead of working directly withe Jest mock function.

`output.isTTY` is also now mutable, so that we can write tests for both
cases when the output is different based on TTY-ness (for example,
see the updated `vc whoami` tests in this PR).
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #6827 (8fd8375) into main (f682aef) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6827      +/-   ##
==========================================
+ Coverage   54.98%   55.03%   +0.05%     
==========================================
  Files          85       85              
  Lines        3592     3594       +2     
  Branches      829      830       +1     
==========================================
+ Hits         1975     1978       +3     
+ Misses       1611     1610       -1     
  Partials        6        6              
Impacted Files Coverage Δ
packages/cli/src/util/output/create-output.ts 51.21% <100.00%> (-0.59%) ⬇️
packages/cli/test/mocks/client.ts 88.88% <100.00%> (+0.65%) ⬆️
packages/cli/src/commands/whoami.ts 72.00% <0.00%> (+4.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f682aef...8fd8375. Read the comment docs.

@TooTallNate TooTallNate merged commit 1be7571 into main Oct 12, 2021
@TooTallNate TooTallNate deleted the update/cli-tests-outputBuffer branch October 12, 2021 23:16
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.

None yet

1 participant