summaryrefslogtreecommitdiff
path: root/test/parallel/test-timers-unref-throw-then-ref.js
blob: 1dd5fdd0ad2786ecf7a66c2a94b8edd3d472b138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const common = require('../common');
const assert = require('assert');

process.once('uncaughtException', common.mustCall((err) => {
  common.expectsError({
    message: 'Timeout Error'
  })(err);
}));

let called = false;
const t = setTimeout(() => {
  assert(!called);
  called = true;
  t.ref();
  throw new Error('Timeout Error');
}, 1).unref();

setTimeout(common.mustCall(), 1);