From 7c497853484c2a6025064116babe0b70c14d4e06 Mon Sep 17 00:00:00 2001 From: madflow Date: Fri, 4 Feb 2022 20:13:01 +0100 Subject: [PATCH] process: fix named report export PR-URL: https://github.com/nodejs/node/pull/41861 Fixes: https://github.com/nodejs/node/issues/41774 Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- lib/internal/bootstrap/pre_execution.js | 2 +- test/es-module/test-esm-process.mjs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js index be5d0c832b6092..6048d89bb08037 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -262,7 +262,7 @@ function setupStacktracePrinterOnSigint() { function initializeReport() { const { report } = require('internal/process/report'); ObjectDefineProperty(process, 'report', { - enumerable: false, + enumerable: true, configurable: true, get() { return report; diff --git a/test/es-module/test-esm-process.mjs b/test/es-module/test-esm-process.mjs index 8fa006a304ed2f..f88eba849df715 100644 --- a/test/es-module/test-esm-process.mjs +++ b/test/es-module/test-esm-process.mjs @@ -1,6 +1,7 @@ import '../common/index.mjs'; import assert from 'assert'; -import process from 'process'; +import process, { report } from 'process'; assert.strictEqual(Object.prototype.toString.call(process), '[object process]'); assert(Object.getOwnPropertyDescriptor(process, Symbol.toStringTag).writable); +assert(report);