0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/pseudo-tty/test-handle-wrap-isrefed-tty.js
Rich Trott aa6fac68da test: adjust indentation for stricter linting
ESLint 4.x has stricter linting than previous versions. We are currently
using the legacy indentation rules in the test directory. This commit
changes the indentation of files to comply with the stricter 4.x linting
and enable stricter linting in the test directory.

PR-URL: https://github.com/nodejs/node/pull/14431
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2017-07-27 09:24:20 -07:00

24 lines
882 B
JavaScript

'use strict';
// see also test/parallel/test-handle-wrap-isrefed.js
const common = require('../common');
const strictEqual = require('assert').strictEqual;
const ReadStream = require('tty').ReadStream;
const tty = new ReadStream(0);
const isTTY = process.binding('tty_wrap').isTTY;
strictEqual(isTTY(0), true, 'tty_wrap: stdin is not a TTY');
strictEqual(Object.getPrototypeOf(tty._handle).hasOwnProperty('hasRef'),
true, 'tty_wrap: hasRef() missing');
strictEqual(tty._handle.hasRef(),
true, 'tty_wrap: not initially refed');
tty.unref();
strictEqual(tty._handle.hasRef(),
false, 'tty_wrap: unref() ineffective');
tty.ref();
strictEqual(tty._handle.hasRef(),
true, 'tty_wrap: ref() ineffective');
tty._handle.close(common.mustCall(() =>
strictEqual(tty._handle.hasRef(),
false, 'tty_wrap: not unrefed on close')));