From 7e977d7cd41cd57ce6bc6b7b639e88377d725cf3 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 5 Jul 2019 17:24:28 +0200 Subject: 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 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Anto Aravinth Reviewed-By: James M Snell --- test/parallel/test-repl-context.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/parallel') 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. -- cgit v1.2.1