From 61ecdf8f125c5a04e478a70e46f310917d60f453 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 da4c2d2a2adeaa..8de57a5666131f 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -238,7 +238,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);