-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update fake-tty for changes in Node.js 12.7.0
- Loading branch information
1 parent
9baca8c
commit 7dcb473
Showing
3 changed files
with
92 additions
and
13 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
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,24 @@ | ||
import test from '../../..'; | ||
|
||
const takesCallbackAndReturnWriteResult = require('tty').WriteStream.prototype.clearLine.length === 1; | ||
|
||
const assert = takesCallbackAndReturnWriteResult ? | ||
async (t, stream) => { | ||
t.is(stream.clearLine.length, 2, 'clearLine'); | ||
await new Promise(resolve => stream.clearLine(0, resolve)); | ||
t.is(stream.clearScreenDown.length, 1, 'clearScreenDown'); | ||
await new Promise(resolve => stream.clearScreenDown(resolve)); | ||
t.is(stream.cursorTo.length, 3, 'cursorTo'); | ||
await new Promise(resolve => stream.cursorTo(0, 0, resolve)); | ||
t.is(stream.moveCursor.length, 3, 'moveCursor'); | ||
await new Promise(resolve => stream.moveCursor(0, 0, resolve)); | ||
} : | ||
(t, stream) => { | ||
t.is(stream.clearLine.length, 1, 'clearLine'); | ||
t.is(stream.clearScreenDown.length, 0, 'clearScreenDown'); | ||
t.is(stream.cursorTo.length, 2, 'cursorTo'); | ||
t.is(stream.moveCursor.length, 2, 'cursorTo'); | ||
}; | ||
|
||
test('stderr tty write methods take / do not take a callback', assert, process.stderr); | ||
test('stdout tty write methods take / do not take a callback', assert, process.stdout); |
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