From 3c8536211f6d2bcd68eefbdf1d044d6b394e059f Mon Sep 17 00:00:00 2001 From: Gergely Nemeth Date: Thu, 7 Sep 2017 09:21:20 +0200 Subject: [PATCH] test: backward compatible api for tty --- test/parallel/test-tty-backwards-api.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/parallel/test-tty-backwards-api.js diff --git a/test/parallel/test-tty-backwards-api.js b/test/parallel/test-tty-backwards-api.js new file mode 100644 index 00000000000000..547184728ebaf8 --- /dev/null +++ b/test/parallel/test-tty-backwards-api.js @@ -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); +});