xref: /third_party/node/test/parallel/test-domain-multiple-errors.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst domain = require('domain');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// This test is similar to test-domain-error-types, but uses a single domain
81cb0ef41Sopenharmony_ci// to emit all errors.
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst d = new domain.Domain();
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst values = [
131cb0ef41Sopenharmony_ci  42, null, undefined, false, () => {}, 'string', Symbol('foo'),
141cb0ef41Sopenharmony_ci];
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_cid.on('error', common.mustCall((err) => {
171cb0ef41Sopenharmony_ci  assert(values.includes(err));
181cb0ef41Sopenharmony_ci}, values.length));
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_cifor (const something of values) {
211cb0ef41Sopenharmony_ci  d.run(common.mustCall(() => {
221cb0ef41Sopenharmony_ci    process.nextTick(common.mustCall(() => {
231cb0ef41Sopenharmony_ci      throw something;
241cb0ef41Sopenharmony_ci    }));
251cb0ef41Sopenharmony_ci  }));
261cb0ef41Sopenharmony_ci}
27

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