mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 16:22:29 +00:00

PR-URL: https://github.com/nodejs/node/pull/14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
15 lines
398 B
JavaScript
15 lines
398 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const EventEmitter = require('events');
|
|
const assert = require('assert');
|
|
|
|
const EE = new EventEmitter();
|
|
|
|
assert.throws(() => {
|
|
EE.emit('error', 'Accepts a string');
|
|
}, /^Error: Unhandled "error" event\. \(Accepts a string\)$/);
|
|
|
|
assert.throws(() => {
|
|
EE.emit('error', { message: 'Error!' });
|
|
}, /^Error: Unhandled "error" event\. \(\[object Object\]\)$/);
|