node/test/fixtures/errors/promise_always_throw_unhandled.js
Moshe Atlow b6738c1af0
test: migrate message tests to use assertSnapshot
PR-URL: https://github.com/nodejs/node/pull/47498
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-04-27 06:41:58 +00:00

16 lines
448 B
JavaScript

// Flags: --unhandled-rejections=strict
'use strict';
require('../../common');
// Check that the process will exit on the first unhandled rejection in case the
// unhandled rejections mode is set to `'strict'`.
const ref1 = new Promise(() => {
throw new Error('One');
});
const ref2 = Promise.reject(new Error('Two'));
// Keep the event loop alive to actually detect the unhandled rejection.
setTimeout(() => console.log(ref1, ref2), 1000);