mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
31ebda24d4
process is an EventEmitter. There are operations that increment and decrement the _eventsCount property of an EventEmitter. process._eventsCount would previously get set to NaN. This change makes process._eventsCount be calculated as expected. PR-URL: https://github.com/nodejs/node/pull/5208 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
23 lines
562 B
JavaScript
23 lines
562 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const sym = Symbol();
|
|
|
|
process.on('normal', common.mustCall((data) => {
|
|
assert.strictEqual(data, 'normalData');
|
|
}));
|
|
|
|
process.on(sym, common.mustCall((data) => {
|
|
assert.strictEqual(data, 'symbolData');
|
|
}));
|
|
|
|
process.on('SIGPIPE', common.mustCall((data) => {
|
|
assert.strictEqual(data, 'signalData');
|
|
}));
|
|
|
|
process.emit('normal', 'normalData');
|
|
process.emit(sym, 'symbolData');
|
|
process.emit('SIGPIPE', 'signalData');
|
|
|
|
assert.strictEqual(isNaN(process._eventsCount), false);
|