node/test/parallel/test-timers-unref-throw-then-ref.js
Antoine du Hamel ef6b8cc3c3
test: ensure assertions are reached on more tests
PR-URL: https://github.com/nodejs/node/pull/60728
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-11-17 17:10:24 +00:00

20 lines
416 B
JavaScript

'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(common.mustCall(() => {
assert(!called);
called = true;
t.ref();
throw new Error('Timeout Error');
}), 1).unref();
setTimeout(common.mustCall(), 1);