mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
757c104147
fixup: add support for `Object.create(null)` fixup: extend to any 1-argument Object.create call fixup: add tests PR-URL: https://github.com/nodejs/node/pull/46083 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
19 lines
486 B
JavaScript
19 lines
486 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const EventEmitter = require('events');
|
|
|
|
// Test emit called by other context
|
|
const EE = new EventEmitter();
|
|
|
|
// Works as expected if the context has no `constructor.name`
|
|
{
|
|
const ctx = { __proto__: null };
|
|
assert.throws(
|
|
() => EE.emit.call(ctx, 'error', new Error('foo')),
|
|
common.expectsError({ name: 'Error', message: 'foo' })
|
|
);
|
|
}
|
|
|
|
assert.strictEqual(EE.emit.call({}, 'foo'), false);
|