xref: /third_party/node/test/parallel/test-promise-unhandled-silent.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci// Flags: --unhandled-rejections=none
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ci// Verify that ignoring unhandled rejection works fine and that no warning is
71cb0ef41Sopenharmony_ci// logged.
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_cinew Promise(() => {
101cb0ef41Sopenharmony_ci  throw new Error('One');
111cb0ef41Sopenharmony_ci});
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciPromise.reject('test');
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciprocess.on('warning', common.mustNotCall('warning'));
161cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustNotCall('uncaughtException'));
171cb0ef41Sopenharmony_ciprocess.on('rejectionHandled', common.mustNotCall('rejectionHandled'));
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciprocess.on('unhandledRejection', common.mustCall(2));
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_cisetTimeout(common.mustCall(), 2);
22

Indexes created Thu Nov 07 10:32:03 CST 2024