summaryrefslogtreecommitdiff
path: root/test/message/promise_always_throw_unhandled.js
blob: d9128f34a5c9f171d449371e0dd3c521f3ac9abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 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);