node/test/parallel/test-eventtarget-custom-inspect-does-not-throw.js
Efe 416db75e42
events: remove eventtarget custom inspect branding
PR-URL: https://github.com/nodejs/node/pull/61128
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2025-12-22 16:14:56 +00:00

20 lines
432 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const util = require('util');
const symbol = util.inspect.custom;
const eventTargetInspect = EventTarget.prototype[symbol];
const fakeEventTarget = {
[symbol]: eventTargetInspect,
someOtherField: 42
};
// Should not throw when calling the custom inspect method
const output = util.inspect(fakeEventTarget);
assert.strictEqual(typeof output, 'string');