Skip to content

repl: don't override all internal repl defaults

Rodrigo Muino Tomonari requested to merge github/fork/cjihrig/globals into master
Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

repl

Description of change

The createInternalRepl() method accepts an options object as an argument. However, if one is provided, it overrides all of the default options. This PR applies the options object to the defaults, only changing the values that are explicitly set.

The approach in this PR also adds a method to test/common.js, allowing specific global variables to be whitelisted. This is because the CLI REPL sets useGlobal to true, and then defines module and require() as globals. Alternative approaches could be to set useGlobal to false (which was what was silently happening before) or set common.globalCheck to false. I prefer the current approach because it is more representative of what happens in the real world, and still performs the global checks.

Merge request reports

Loading