Skip to content

Commit 62fb5db

Browse files
BridgeARBethGriggs
authored andcommitted
assert: revert breaking change
It was not intended to change the `assert.doesNotThrow()` message with #23223. This reverts the breaking behavior to the one before. PR-URL: #24786 Refs: #23223 Reviewed-By: Beth Griggs <[email protected]>
1 parent 74c1074 commit 62fb5db

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ function expectsNoError(stackStartFn, actual, error, message) {
782782
actual,
783783
expected: error,
784784
operator: stackStartFn.name,
785-
message: `Got unwanted ${fnType}${details}\n${actual.message}`,
785+
message: `Got unwanted ${fnType}${details}`,
786786
stackStartFn
787787
});
788788
}

test/parallel/test-assert-async.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ common.crashOnUnhandledRejection();
3434
assert(err instanceof assert.AssertionError,
3535
`${err.name} is not instance of AssertionError`);
3636
assert.strictEqual(err.code, 'ERR_ASSERTION');
37-
assert(/^Got unwanted rejection\.\n$/.test(err.message));
37+
assert(/^Got unwanted rejection\.$/.test(err.message));
3838
assert.strictEqual(err.operator, 'doesNotReject');
3939
assert.ok(!err.stack.includes('at Function.doesNotReject'));
4040
return true;

test/parallel/test-assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ common.expectsError(
460460
type: a.AssertionError,
461461
code: 'ERR_ASSERTION',
462462
operator: 'doesNotThrow',
463-
message: 'Got unwanted exception: user message\n[object Object]'
463+
message: 'Got unwanted exception: user message'
464464
}
465465
);
466466

0 commit comments

Comments
 (0)