diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-10 02:33:08 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-16 16:54:07 +0100 |
commit | 644fdd60d4be49ffa66d0bda1702c4459f607635 (patch) | |
tree | 70da98bc22a5a6c5bd0063e25d6eb729125706bf /test/parallel/test-internal-util-decorate-error-stack.js | |
parent | caee112e52b64f4bc1118c4a5fa5ad7b4211efea (diff) | |
download | android-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.tar.gz android-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.tar.bz2 android-node-v8-644fdd60d4be49ffa66d0bda1702c4459f607635.zip |
test: minor refactoring
Add punctuation and comments about code that should not throw.
Also remove a obsolete test and refactor some tests.
PR-URL: https://github.com/nodejs/node/pull/18669
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-internal-util-decorate-error-stack.js')
-rw-r--r-- | test/parallel/test-internal-util-decorate-error-stack.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/parallel/test-internal-util-decorate-error-stack.js b/test/parallel/test-internal-util-decorate-error-stack.js index 25141b5ea7..9d20374409 100644 --- a/test/parallel/test-internal-util-decorate-error-stack.js +++ b/test/parallel/test-internal-util-decorate-error-stack.js @@ -12,12 +12,13 @@ const kDecoratedPrivateSymbolIndex = binding['decorated_private_symbol']; const decorateErrorStack = internalUtil.decorateErrorStack; +// Verify that decorateErrorStack does not throw with non-objects. decorateErrorStack(); decorateErrorStack(null); decorateErrorStack(1); decorateErrorStack(true); -// Verify that a stack property is not added to non-Errors +// Verify that a stack property is not added to non-Errors. const obj = {}; decorateErrorStack(obj); assert.strictEqual(obj.stack, undefined); @@ -46,12 +47,12 @@ try { assert(typeof err, 'object'); checkStack(err.stack); -// Verify that the stack is only decorated once +// Verify that the stack is only decorated once. decorateErrorStack(err); decorateErrorStack(err); checkStack(err.stack); -// Verify that the stack is only decorated once for uncaught exceptions +// Verify that the stack is only decorated once for uncaught exceptions. const args = [ '-e', `require('${badSyntaxPath}')` @@ -59,14 +60,14 @@ const args = [ const result = spawnSync(process.argv[0], args, { encoding: 'utf8' }); checkStack(result.stderr); -// Verify that the stack is unchanged when there is no arrow message +// Verify that the stack is unchanged when there is no arrow message. err = new Error('foo'); let originalStack = err.stack; decorateErrorStack(err); assert.strictEqual(originalStack, err.stack); // Verify that the arrow message is added to the start of the stack when it -// exists +// exists. const arrowMessage = 'arrow_message'; err = new Error('foo'); originalStack = err.stack; |