You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
355 B

'use strict';
require('../common');
const assert = require('assert');
let once = 0;
process.on('beforeExit', () => {
if (once > 1)
throw new RangeError('beforeExit should only have been called once!');
setTimeout(() => {}, 1).unref();
once++;
});
process.on('exit', (code) => {
if (code !== 0) return;
assert.strictEqual(once, 1);
});