test: backward compatible api for tty
PR-URL: https://github.com/nodejs/node/pull/15235 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
This commit is contained in:
parent
10be20a0e8
commit
750c0802f5
25
test/parallel/test-tty-backwards-api.js
Normal file
25
test/parallel/test-tty-backwards-api.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
'use strict';
|
||||||
|
const common = require('../common');
|
||||||
|
|
||||||
|
const noop = () => {};
|
||||||
|
const TTY = process.binding('tty_wrap').TTY = function() {};
|
||||||
|
|
||||||
|
TTY.prototype = {
|
||||||
|
setBlocking: noop,
|
||||||
|
getWindowSize: noop
|
||||||
|
};
|
||||||
|
|
||||||
|
const { WriteStream } = require('tty');
|
||||||
|
|
||||||
|
const methods = [
|
||||||
|
'cursorTo',
|
||||||
|
'moveCursor',
|
||||||
|
'clearLine',
|
||||||
|
'clearScreenDown'
|
||||||
|
];
|
||||||
|
|
||||||
|
methods.forEach((method) => {
|
||||||
|
require('readline')[method] = common.mustCall();
|
||||||
|
const writeStream = new WriteStream(1);
|
||||||
|
writeStream[method](1, 2);
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user