• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4
5// This test ensures that util.inspect logs getters
6// which access this.
7
8const assert = require('assert');
9
10const util = require('util');
11
12class X {
13  constructor() {
14    this._y = 123;
15  }
16
17  get y() {
18    return this._y;
19  }
20}
21
22const result = util.inspect(new X(), {
23  getters: true,
24  showHidden: true
25});
26
27assert.strictEqual(
28  result,
29  'X { _y: 123, [y]: [Getter: 123] }'
30);
31