summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-base-prototype-accessors-enumerability.js
blob: 1a7f6808fe1780efd3dadc24da45773ac457ec86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Flags: --expose-internals
'use strict';

require('../common');

// This tests that the prototype accessors added by StreamBase::AddMethods
// are not enumerable. They could be enumerated when inspecting the prototype
// with util.inspect or the inspector protocol.

const assert = require('assert');

// Or anything that calls StreamBase::AddMethods when setting up its prototype
const { internalBinding } = require('internal/test/binding');
const TTY = internalBinding('tty_wrap').TTY;

{
  const ttyIsEnumerable = Object.prototype.propertyIsEnumerable.bind(TTY);
  assert.strictEqual(ttyIsEnumerable('bytesRead'), false);
  assert.strictEqual(ttyIsEnumerable('fd'), false);
  assert.strictEqual(ttyIsEnumerable('_externalStream'), false);
}