node/test/parallel/test-timers-uncaught-exception.js
Beth Griggs 7c77932fa2 test: refactor several parallel/test-timer tests
Change var to const/let. Simplify test-timers-uncaught-exception.

PR-URL: https://github.com/nodejs/node/pull/10524
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-01-03 17:18:36 +00:00

19 lines
459 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const errorMsg = 'BAM!';
// the first timer throws...
setTimeout(common.mustCall(function() {
throw new Error(errorMsg);
}), 1);
// ...but the second one should still run
setTimeout(common.mustCall(function() {}), 1);
function uncaughtException(err) {
assert.strictEqual(err.message, errorMsg);
}
process.on('uncaughtException', common.mustCall(uncaughtException));