xref: /third_party/node/test/parallel/test-promise-unhandled-silent-no-hook.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_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// Verify that ignoring unhandled rejection works fine and that no warning is
81cb0ef41Sopenharmony_ci// logged even though there is no unhandledRejection hook attached.
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cinew Promise(() => {
111cb0ef41Sopenharmony_ci  throw new Error('One');
121cb0ef41Sopenharmony_ci});
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciPromise.reject('test');
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciprocess.on('warning', common.mustNotCall('warning'));
171cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustNotCall('uncaughtException'));
181cb0ef41Sopenharmony_ciprocess.on('exit', assert.strictEqual.bind(null, 0));
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cisetTimeout(common.mustCall(), 2);
21

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