diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-05-13 14:17:03 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-05-16 12:52:49 +0200 |
commit | e632b1b7eeb0900472c710ae7269111d985de018 (patch) | |
tree | 4ada8fee2ced19e9939db8ba271b8c9ab493f1e7 /lib/internal/assert | |
parent | a9f518c901459e42afc76871dab9867967e9fa23 (diff) | |
download | android-node-v8-e632b1b7eeb0900472c710ae7269111d985de018.tar.gz android-node-v8-e632b1b7eeb0900472c710ae7269111d985de018.tar.bz2 android-node-v8-e632b1b7eeb0900472c710ae7269111d985de018.zip |
assert: add compatibility for older Node.js versions
This makes sure the `AssertionError` still accepts the
`stackStartFunction` option as alternative to the `stackStartFn`.
PR-URL: https://github.com/nodejs/node/pull/27672
Fixes: https://github.com/nodejs/node/issues/27671
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/internal/assert')
-rw-r--r-- | lib/internal/assert/assertion_error.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js index 048d7be75f..b0226e879a 100644 --- a/lib/internal/assert/assertion_error.js +++ b/lib/internal/assert/assertion_error.js @@ -298,7 +298,9 @@ class AssertionError extends Error { const { message, operator, - stackStartFn + stackStartFn, + // Compatibility with older versions. + stackStartFunction } = options; let { actual, @@ -418,7 +420,7 @@ class AssertionError extends Error { this.expected = expected; this.operator = operator; // eslint-disable-next-line no-restricted-syntax - Error.captureStackTrace(this, stackStartFn); + Error.captureStackTrace(this, stackStartFn || stackStartFunction); // Create error message including the error code in the name. this.stack; // Reset the name. |