From 62fb5dbec557745f9f828d728ca25f327ca5300c Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sun, 2 Dec 2018 14:08:01 +0100 Subject: [PATCH] assert: revert breaking change It was not intended to change the `assert.doesNotThrow()` message with https://github.com/nodejs/node/pull/23223. This reverts the breaking behavior to the one before. PR-URL: https://github.com/nodejs/node/pull/24786 Refs: https://github.com/nodejs/node/pull/23223 Reviewed-By: Beth Griggs --- lib/assert.js | 2 +- test/parallel/test-assert-async.js | 2 +- test/parallel/test-assert.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/assert.js b/lib/assert.js index 594a5acfbde1e3..e29a381acb746d 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -782,7 +782,7 @@ function expectsNoError(stackStartFn, actual, error, message) { actual, expected: error, operator: stackStartFn.name, - message: `Got unwanted ${fnType}${details}\n${actual.message}`, + message: `Got unwanted ${fnType}${details}`, stackStartFn }); } diff --git a/test/parallel/test-assert-async.js b/test/parallel/test-assert-async.js index c397a4db081d49..237df0bb66ab28 100644 --- a/test/parallel/test-assert-async.js +++ b/test/parallel/test-assert-async.js @@ -34,7 +34,7 @@ common.crashOnUnhandledRejection(); assert(err instanceof assert.AssertionError, `${err.name} is not instance of AssertionError`); assert.strictEqual(err.code, 'ERR_ASSERTION'); - assert(/^Got unwanted rejection\.\n$/.test(err.message)); + assert(/^Got unwanted rejection\.$/.test(err.message)); assert.strictEqual(err.operator, 'doesNotReject'); assert.ok(!err.stack.includes('at Function.doesNotReject')); return true; diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 7335982a6c6dc5..acedd9ed4fd75b 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -460,7 +460,7 @@ common.expectsError( type: a.AssertionError, code: 'ERR_ASSERTION', operator: 'doesNotThrow', - message: 'Got unwanted exception: user message\n[object Object]' + message: 'Got unwanted exception: user message' } );