diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-09-23 19:38:12 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-12-06 02:10:58 +0100 |
commit | 6c40cb2aca89df4c7c0e3923d93024734dd49f2d (patch) | |
tree | ceb06cf66682bc843e8e0953cd8092a1179c46b5 /test/parallel/test-repl-pretty-stack.js | |
parent | 51ccf1b5e90540a11c33866da15d4a7f52d7fddb (diff) | |
download | android-node-v8-6c40cb2aca89df4c7c0e3923d93024734dd49f2d.tar.gz android-node-v8-6c40cb2aca89df4c7c0e3923d93024734dd49f2d.tar.bz2 android-node-v8-6c40cb2aca89df4c7c0e3923d93024734dd49f2d.zip |
repl: use better uncaught exceptions indicator
This switches "Thrown:" with "Uncaught" to outline clearer that the
thrown error is not caught.
PR-URL: https://github.com/nodejs/node/pull/29676
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-pretty-stack.js')
-rw-r--r-- | test/parallel/test-repl-pretty-stack.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/parallel/test-repl-pretty-stack.js b/test/parallel/test-repl-pretty-stack.js index 9f307c4f43..456e866b7b 100644 --- a/test/parallel/test-repl-pretty-stack.js +++ b/test/parallel/test-repl-pretty-stack.js @@ -7,7 +7,7 @@ const repl = require('repl'); const stackRegExp = /(at .*repl:)[0-9]+:[0-9]+/g; -function run({ command, expected, ...extraREPLOptions }) { +function run({ command, expected, ...extraREPLOptions }, i) { let accum = ''; const inputStream = new ArrayStream(); @@ -25,6 +25,7 @@ function run({ command, expected, ...extraREPLOptions }) { }); r.write(`${command}\n`); + console.log(i); assert.strictEqual( accum.replace(stackRegExp, '$1*:*'), expected.replace(stackRegExp, '$1*:*') @@ -36,39 +37,39 @@ const tests = [ { // Test .load for a file that throws. command: `.load ${fixtures.path('repl-pretty-stack.js')}`, - expected: 'Thrown:\nError: Whoops!\n at repl:*:*\n' + + expected: 'Uncaught Error: Whoops!\n at repl:*:*\n' + ' at d (repl:*:*)\n at c (repl:*:*)\n' + ' at b (repl:*:*)\n at a (repl:*:*)\n' }, { command: 'let x y;', - expected: 'Thrown:\n' + - 'let x y;\n ^\n\nSyntaxError: Unexpected identifier\n' + expected: 'let x y;\n ^\n\n' + + 'Uncaught SyntaxError: Unexpected identifier\n' }, { command: 'throw new Error(\'Whoops!\')', - expected: 'Thrown:\nError: Whoops!\n' + expected: 'Uncaught Error: Whoops!\n' }, { command: '(() => { const err = Error(\'Whoops!\'); ' + 'err.foo = \'bar\'; throw err; })()', - expected: "Thrown:\nError: Whoops!\n at repl:*:* {\n foo: 'bar'\n}\n", + expected: "Uncaught Error: Whoops!\n at repl:*:* {\n foo: 'bar'\n}\n", }, { command: '(() => { const err = Error(\'Whoops!\'); ' + 'err.foo = \'bar\'; throw err; })()', - expected: 'Thrown:\nError: Whoops!\n at repl:*:* {\n foo: ' + + expected: 'Uncaught Error: Whoops!\n at repl:*:* {\n foo: ' + "\u001b[32m'bar'\u001b[39m\n}\n", useColors: true }, { command: 'foo = bar;', - expected: 'Thrown:\nReferenceError: bar is not defined\n' + expected: 'Uncaught ReferenceError: bar is not defined\n' }, // Test anonymous IIFE. { command: '(function() { throw new Error(\'Whoops!\'); })()', - expected: 'Thrown:\nError: Whoops!\n at repl:*:*\n' + expected: 'Uncaught Error: Whoops!\n at repl:*:*\n' } ]; |