1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const EventEmitter = require('events');
5
6// Test emit called by other context
7const EE = new EventEmitter();
8
9// Works as expected if the context has no `constructor.name`
10{
11  const ctx = Object.create(null);
12  assert.throws(
13    () => EE.emit.call(ctx, 'error', new Error('foo')),
14    common.expectsError({ name: 'Error', message: 'foo' })
15  );
16}
17
18assert.strictEqual(EE.emit.call({}, 'foo'), false);
19