11cb0ef41Sopenharmony_ci// Flags: --unhandled-rejections=warn
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci// Verify that --unhandled-rejections=warn works fine
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cinew Promise(() => {
91cb0ef41Sopenharmony_ci  throw new Error('One');
101cb0ef41Sopenharmony_ci});
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciPromise.reject('test');
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// Unhandled rejections trigger two warning per rejection. One is the rejection
151cb0ef41Sopenharmony_ci// reason and the other is a note where this warning is coming from.
161cb0ef41Sopenharmony_ciprocess.on('warning', common.mustCall(4));
171cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustNotCall('uncaughtException'));
181cb0ef41Sopenharmony_ciprocess.on('rejectionHandled', common.mustNotCall('rejectionHandled'));
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cisetTimeout(common.mustCall(), 2);
21