summaryrefslogtreecommitdiff
path: root/test/parallel/test-util-primordial-monkeypatching.js
blob: bf282a121228728204f66a733395e44b19133bc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
'use strict';

// Monkeypatch Object.keys() so that it throws an unexpected error. This tests
// that `util.inspect()` is unaffected by monkey-patching `Object`.

require('../common');
const assert = require('assert');
const util = require('util');

Object.keys = () => { throw new Error('fhqwhgads'); };
assert.strictEqual(util.inspect({}), '{}');