1'use strict'; 2 3// Used to test the `uncaughtException` err object 4 5const assert = require('assert'); 6const { callbackify } = require('util'); 7 8{ 9 const sentinel = new Error(__filename); 10 process.once('uncaughtException', (err) => { 11 assert.notStrictEqual(err, sentinel); 12 // Calling test will use `stdout` to assert value of `err.message` 13 console.log(err.message); 14 }); 15 16 function fn() { 17 return Promise.reject(sentinel); 18 } 19 20 const cbFn = callbackify(fn); 21 cbFn((err, ret) => assert.ifError(err)); 22} 23