Skip to content

Commit

Permalink
esm: process proxy Symbol.toString fix
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
guybedford committed Mar 3, 2019
1 parent 1d97374 commit ccaebde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ function setupProcessObject() {
const origProcProto = Object.getPrototypeOf(process);
Object.setPrototypeOf(origProcProto, EventEmitter.prototype);
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
Object.defineProperty(global, 'process', {
value: process,
Expand Down
6 changes: 6 additions & 0 deletions test/es-module/test-esm-process.mjs
Original file line number Diff line number Diff line change
@@ -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]');

0 comments on commit ccaebde

Please sign in to comment.