diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-07-05 17:24:28 +0200 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-07-17 20:59:12 -0700 |
commit | 7e977d7cd41cd57ce6bc6b7b639e88377d725cf3 (patch) | |
tree | 09f91cc22d278a5a965586e7b008d4a3b10632fe /test/parallel/test-repl-context.js | |
parent | 6874aa1fb15e815bacf0b0f7e18a434d72de0b4d (diff) | |
download | node-new-7e977d7cd41cd57ce6bc6b7b639e88377d725cf3.tar.gz |
repl: fix some repl context issues
This partially fixes contexts like `{} instanceof Object === false`
in the REPL. This does not fix all cases, since it's something
fundamental from the REPL's design that things like these can happen.
Refs: https://github.com/nodejs/node/issues/27859
PR-URL: https://github.com/nodejs/node/pull/28561
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-context.js')
-rw-r--r-- | test/parallel/test-repl-context.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/parallel/test-repl-context.js b/test/parallel/test-repl-context.js index 287d8adc29..88bd47a928 100644 --- a/test/parallel/test-repl-context.js +++ b/test/parallel/test-repl-context.js @@ -16,11 +16,21 @@ const stream = new ArrayStream(); useGlobal: false }); + let output = ''; + stream.write = function(d) { + output += d; + }; + // Ensure that the repl context gets its own "console" instance. assert(r.context.console); // Ensure that the repl console instance is not the global one. assert.notStrictEqual(r.context.console, console); + assert.notStrictEqual(r.context.Object, Object); + + stream.run(['({} instanceof Object)']); + + assert.strictEqual(output, 'true\n> '); const context = r.createContext(); // Ensure that the repl context gets its own "console" instance. |