Skip to content

Commit 5c99fc3

Browse files
gergelykeMylesBorins
authored andcommitted
test: backward compatible api for tty
PR-URL: #15235 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 06ee10e commit 5c99fc3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
const common = require('../common');
3+
4+
const noop = () => {};
5+
const TTY = process.binding('tty_wrap').TTY = function() {};
6+
7+
TTY.prototype = {
8+
setBlocking: noop,
9+
getWindowSize: noop
10+
};
11+
12+
const { WriteStream } = require('tty');
13+
14+
const methods = [
15+
'cursorTo',
16+
'moveCursor',
17+
'clearLine',
18+
'clearScreenDown'
19+
];
20+
21+
methods.forEach((method) => {
22+
require('readline')[method] = common.mustCall();
23+
const writeStream = new WriteStream(1);
24+
writeStream[method](1, 2);
25+
});

0 commit comments

Comments
 (0)