summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-12-15 21:09:12 -0200
committerMyles Borins <mylesborins@google.com>2018-10-31 13:45:02 -0400
commitc9d84b6d4f792831a6d88e902c6ddf11e38b9e7e (patch)
treeaf057e4b9de5cceae9617f8b0cd1d7a465cec40d /test
parenta42d0726ac166dd3b0adb4d0450d2c1d8fb93e04 (diff)
downloadnode-new-c9d84b6d4f792831a6d88e902c6ddf11e38b9e7e.tar.gz
assert: fix throws and doesNotThrow stack frames
The stack frames from .throws and .doesNotThrow got included even though that was not intended. Backport-PR-URL: https://github.com/nodejs/node/pull/23223 PR-URL: https://github.com/nodejs/node/pull/17703 Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-assert.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index 2d5b38d0dc..a8ba1bf5d1 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -603,6 +603,7 @@ testAssertionMessage({ a: NaN, b: Infinity, c: -Infinity },
} catch (e) {
threw = true;
assert.strictEqual(e.message, 'Missing expected exception.');
+ assert.ok(!e.stack.includes('throws'), e.stack);
}
assert.ok(threw);
}
@@ -619,8 +620,8 @@ try {
assert.strictEqual(1, 2, 'oh no'); // eslint-disable-line no-restricted-syntax
} catch (e) {
assert.strictEqual(e.message.split('\n')[0], 'oh no');
- // Message should not be marked as generated.
- assert.strictEqual(e.generatedMessage, false);
+ assert.strictEqual(e.generatedMessage, false,
+ 'Message incorrectly marked as generated');
}
{