mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 16:22:29 +00:00

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>
45 lines
991 B
JavaScript
45 lines
991 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const tty = require('tty');
|
|
|
|
assert.throws(() => {
|
|
new tty.WriteStream(-1);
|
|
}, common.expectsError({
|
|
code: 'ERR_INVALID_FD',
|
|
type: RangeError,
|
|
message: '"fd" must be a positive integer: -1'
|
|
})
|
|
);
|
|
|
|
const err_regex = common.isWindows ?
|
|
/^Error: EBADF: bad file descriptor, uv_tty_init$/ :
|
|
/^Error: EINVAL: invalid argument, uv_tty_init$/;
|
|
assert.throws(() => {
|
|
let fd = 2;
|
|
// Get first known bad file descriptor.
|
|
try {
|
|
while (fs.fstatSync(++fd));
|
|
} catch (e) { }
|
|
new tty.WriteStream(fd);
|
|
}, err_regex);
|
|
|
|
assert.throws(() => {
|
|
new tty.ReadStream(-1);
|
|
}, common.expectsError({
|
|
code: 'ERR_INVALID_FD',
|
|
type: RangeError,
|
|
message: '"fd" must be a positive integer: -1'
|
|
})
|
|
);
|
|
|
|
assert.throws(() => {
|
|
let fd = 2;
|
|
// Get first known bad file descriptor.
|
|
try {
|
|
while (fs.fstatSync(++fd));
|
|
} catch (e) { }
|
|
new tty.ReadStream(fd);
|
|
}, err_regex);
|