diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-08 12:21:35 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-25 16:28:07 +0100 |
commit | 97737fd5fb4a6b36c2e65905b8cf3518499a8a5e (patch) | |
tree | 0028cc7ca3c42d3474097f86d8b0c026a34d633d /test/parallel/test-repl-envvars.js | |
parent | 96204c3c71f6cc571be56269ba9d584d615f0a06 (diff) | |
download | android-node-v8-97737fd5fb4a6b36c2e65905b8cf3518499a8a5e.tar.gz android-node-v8-97737fd5fb4a6b36c2e65905b8cf3518499a8a5e.tar.bz2 android-node-v8-97737fd5fb4a6b36c2e65905b8cf3518499a8a5e.zip |
repl: fix terminal default setting
This makes sure that the described default behavior for the
`terminal` option is actually always used and not only when running
the REPL as standalone program.
The options code is now logically combined instead of being spread
out in the big REPL constructor.
PR-URL: https://github.com/nodejs/node/pull/26518
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-envvars.js')
-rw-r--r-- | test/parallel/test-repl-envvars.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/parallel/test-repl-envvars.js b/test/parallel/test-repl-envvars.js index 6679cd6cd7..4fab77b7c0 100644 --- a/test/parallel/test-repl-envvars.js +++ b/test/parallel/test-repl-envvars.js @@ -38,19 +38,25 @@ const tests = [ function run(test) { const env = test.env; const expected = test.expected; + const opts = { terminal: true, input: new stream.Readable({ read() {} }), output: new stream.Writable({ write() {} }) }; - REPL.createInternalRepl(env, opts, function(err, repl) { + Object.assign(process.env, env); + + REPL.createInternalRepl(process.env, opts, function(err, repl) { assert.ifError(err); assert.strictEqual(repl.terminal, expected.terminal, `Expected ${inspect(expected)} with ${inspect(env)}`); assert.strictEqual(repl.useColors, expected.useColors, `Expected ${inspect(expected)} with ${inspect(env)}`); + for (const key of Object.keys(env)) { + delete process.env[key]; + } repl.close(); }); } |