test: backward compatible api for tty · nodejs/node@5c99fc3

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+

});