mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-06 21:07:47 +00:00
[cli] Add outputBuffer getter and mutable isTTY for tests (#6827)
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).
This commit is contained in:
@@ -20,15 +20,13 @@ export class Output {
|
||||
private debugEnabled: boolean;
|
||||
private spinnerMessage: string;
|
||||
private _spinner: StopSpinner | null;
|
||||
isTTY: boolean;
|
||||
|
||||
constructor({ debug: debugEnabled = false }: OutputOptions = {}) {
|
||||
this.debugEnabled = debugEnabled;
|
||||
this.spinnerMessage = '';
|
||||
this._spinner = null;
|
||||
}
|
||||
|
||||
get isTTY() {
|
||||
return process.stdout.isTTY;
|
||||
this.isTTY = process.stdout.isTTY || false;
|
||||
}
|
||||
|
||||
isDebugEnabled = () => {
|
||||
|
||||
Reference in New Issue
Block a user