esm: process proxy Symbol.toString fix
PR-URL: https://github.com/nodejs/node/pull/25963 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
1d97374f69
commit
ccaebdef66
@ -309,6 +309,12 @@ function setupProcessObject() {
|
|||||||
const origProcProto = Object.getPrototypeOf(process);
|
const origProcProto = Object.getPrototypeOf(process);
|
||||||
Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
|
Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
|
||||||
EventEmitter.call(process);
|
EventEmitter.call(process);
|
||||||
|
Object.defineProperty(process, Symbol.toStringTag, {
|
||||||
|
enumerable: false,
|
||||||
|
writable: false,
|
||||||
|
configurable: false,
|
||||||
|
value: 'process'
|
||||||
|
});
|
||||||
// Make process globally available to users by putting it on the global proxy
|
// Make process globally available to users by putting it on the global proxy
|
||||||
Object.defineProperty(global, 'process', {
|
Object.defineProperty(global, 'process', {
|
||||||
value: process,
|
value: process,
|
||||||
|
6
test/es-module/test-esm-process.mjs
Normal file
6
test/es-module/test-esm-process.mjs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// Flags: --experimental-modules
|
||||||
|
import '../common';
|
||||||
|
import assert from 'assert';
|
||||||
|
import process from 'process';
|
||||||
|
|
||||||
|
assert.strictEqual(Object.prototype.toString.call(process), '[object process]');
|
Loading…
x
Reference in New Issue
Block a user