-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
repl: useGlobal docs and code mismatchΒ #5659
Copy link
Copy link
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The API documentation for REPL says,
"
useGlobal- if set totrue, then the repl will use the global object, instead of running scripts in a separate context. Defaults tofalse."This is only true if a REPL is created programmatically. The REPL that is created by simply typing
nodeon the command line defaultsuseGlobaltotrue.This is because the internal
createReplfunction, used bynode.jshere, defaults this value totrue. https://github.com/nodejs/node/blob/master/lib/internal/repl.js#L25This can be verified by simply firing up a node REPL and typing
.clear. You should see on the REPL command line, this text, "Clearing context....", but you don't.