xref: /third_party/node/test/parallel/test-http-client-req-error-dont-double-fire.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_ci// This tests that the error emitted on the socket does
41cb0ef41Sopenharmony_ci// not get fired again when the 'error' event handler throws
51cb0ef41Sopenharmony_ci// an error.
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst common = require('../common');
81cb0ef41Sopenharmony_ciconst { addresses } = require('../common/internet');
91cb0ef41Sopenharmony_ciconst { errorLookupMock } = require('../common/dns');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst assert = require('assert');
121cb0ef41Sopenharmony_ciconst http = require('http');
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciconst host = addresses.INVALID_HOST;
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst req = http.get({
171cb0ef41Sopenharmony_ci  host,
181cb0ef41Sopenharmony_ci  lookup: common.mustCall(errorLookupMock())
191cb0ef41Sopenharmony_ci});
201cb0ef41Sopenharmony_ciconst err = new Error('mock unexpected code error');
211cb0ef41Sopenharmony_cireq.on('error', common.mustCall(() => {
221cb0ef41Sopenharmony_ci  throw err;
231cb0ef41Sopenharmony_ci}));
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustCall((e) => {
261cb0ef41Sopenharmony_ci  assert.strictEqual(e, err);
271cb0ef41Sopenharmony_ci}));
28

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