-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: wrap stdout and stderr * fix: spinners * fix: return type on Command.run * fix: update Command._run return type * chore: remove unnecessary assertion * feat: add logJson protected method * chore: small fixes * chore: tests * chore: json regression
- Loading branch information
1 parent
499c533
commit 39ea8ea
Showing
17 changed files
with
150 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,4 +114,4 @@ | |
"pretest": "yarn build --noEmit && tsc -p test --noEmit --skipLibCheck" | ||
}, | ||
"types": "lib/index.d.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* A wrapper around process.stdout and process.stderr that allows us to mock out the streams for testing. | ||
*/ | ||
class Stream { | ||
public constructor(public channel: 'stdout' | 'stderr') {} | ||
|
||
public get isTTY(): boolean { | ||
return process[this.channel].isTTY | ||
} | ||
|
||
public getWindowSize(): number[] { | ||
return process[this.channel].getWindowSize() | ||
} | ||
|
||
public write(data: string): boolean { | ||
return process[this.channel].write(data) | ||
} | ||
|
||
public read(): boolean { | ||
return process[this.channel].read() | ||
} | ||
|
||
public on(event: string, listener: (...args: any[]) => void): Stream { | ||
process[this.channel].on(event, listener) | ||
return this | ||
} | ||
|
||
public once(event: string, listener: (...args: any[]) => void): Stream { | ||
process[this.channel].once(event, listener) | ||
return this | ||
} | ||
|
||
public emit(event: string, ...args: any[]): boolean { | ||
return process[this.channel].emit(event, ...args) | ||
} | ||
} | ||
|
||
export const stdout = new Stream('stdout') | ||
export const stderr = new Stream('stderr') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.