xref: /third_party/node/test/report/test-report-uncaught-exception-handled.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/report/
11cb0ef41Sopenharmony_ci// Flags: --report-uncaught-exception
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci// Test report is suppressed on uncaught exception hook.
41cb0ef41Sopenharmony_ciconst common = require('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ciconst helper = require('../common/report');
71cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir');
81cb0ef41Sopenharmony_ciconst error = new Error('test error');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_citmpdir.refresh();
111cb0ef41Sopenharmony_ciprocess.report.directory = tmpdir.path;
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci// Make sure the uncaughtException listener is called.
141cb0ef41Sopenharmony_ciprocess.on('uncaughtException', common.mustCall());
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciprocess.on('exit', (code) => {
171cb0ef41Sopenharmony_ci  assert.strictEqual(code, 0);
181cb0ef41Sopenharmony_ci  // Make sure no reports are generated.
191cb0ef41Sopenharmony_ci  const reports = helper.findReports(process.pid, tmpdir.path);
201cb0ef41Sopenharmony_ci  assert.strictEqual(reports.length, 0);
211cb0ef41Sopenharmony_ci});
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_cithrow error;
24

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