From ccb303e03795cee25527edb867f7903477ed5de6 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Tue, 21 Aug 2018 03:22:18 +0200 Subject: repl: improve error output 1) Currently extra properties on an error will be ignored, if thrown. This information will from now on be visible. 2) In case someone threw a non error object it would have resulted in `[object Object]`. Instead, the full object will now be visible. 3) Some cases were not detected properly as error before and "Thrown: " was visible before. That is now fixed. PR-URL: https://github.com/nodejs/node/pull/22436 Refs: https://github.com/nodejs/node/issues/20253 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-repl.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/parallel/test-repl.js') diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 8cb4b686b8..49e718da0f 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -132,7 +132,11 @@ const errorTests = [ // Uncaught error throws and prints out { send: 'throw new Error(\'test error\');', - expect: /^Error: test error/ + expect: 'Error: test error' + }, + { + send: "throw { foo: 'bar' };", + expect: "Thrown: { foo: 'bar' }" }, // Common syntax error is treated as multiline command { @@ -526,7 +530,7 @@ const errorTests = [ { send: 'require("internal/repl")', expect: [ - /^Error: Cannot find module 'internal\/repl'/, + /^{ Error: Cannot find module 'internal\/repl'/, /^ at .*/, /^ at .*/, /^ at .*/, -- cgit v1.2.3