diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-21 03:22:18 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-27 14:08:43 +0200 |
commit | ccb303e03795cee25527edb867f7903477ed5de6 (patch) | |
tree | 14e8cf7cb3d2fc6c5a0f0f2ec357217894b97ecd /test/parallel/test-repl.js | |
parent | 50aa85dc9bf47c7fad280aba40401a14c81a1aac (diff) | |
download | android-node-v8-ccb303e03795cee25527edb867f7903477ed5de6.tar.gz android-node-v8-ccb303e03795cee25527edb867f7903477ed5de6.tar.bz2 android-node-v8-ccb303e03795cee25527edb867f7903477ed5de6.zip |
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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-repl.js')
-rw-r--r-- | test/parallel/test-repl.js | 8 |
1 files changed, 6 insertions, 2 deletions
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 .*/, |