0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-25 08:19:38 +01:00
nodejs/test/parallel/test-process-next-tick.js

25 lines
456 B
JavaScript
Raw Normal View History

2012-02-20 13:22:12 +01:00
var common = require('../common');
var assert = require('assert');
var N = 2;
var tickCount = 0;
var exceptionCount = 0;
function cb() {
++tickCount;
throw new Error();
}
for (var i = 0; i < N; ++i) {
process.nextTick(cb);
}
process.on('uncaughtException', function() {
++exceptionCount;
});
process.on('exit', function() {
process.removeAllListeners('uncaughtException');
assert.equal(tickCount, N);
assert.equal(exceptionCount, N);
});