Skip to content

Commit

Permalink
test: backward compatible api for tty
Browse files Browse the repository at this point in the history
PR-URL: #15235
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
  • Loading branch information
gergelyke authored and jasnell committed Sep 20, 2017
1 parent a792ea7 commit d82ae0c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/parallel/test-tty-backwards-api.js
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit d82ae0c

Please sign in to comment.