Commit Graph

4 Commits

Author SHA1 Message Date
Ruben Bridgewater
62fb5dbec5
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 <Bethany.Griggs@uk.ibm.com>
2018-12-11 15:18:30 +00:00
Teddy Katz
0d241ba385
assert: ensure .rejects() disallows sync throws
This updates `assert.rejects()` to disallow any errors that are thrown
synchronously from the given function. Previously, throwing an error
would cause the same behavior as returning a rejected Promise.

Fixes: https://github.com/nodejs/node/issues/19646
Backport-PR-URL: https://github.com/nodejs/node/pull/24019
PR-URL: https://github.com/nodejs/node/pull/19650
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-11-04 12:31:09 +00:00
Teddy Katz
3cd4462370
test: ensure failed assertions cause build to fail
This updates the test in `test/parallel/test-assert-async.js` to add an
assertion that the Promises used in the test end up fulfilled.
Previously, if an assertion failure occurred, the Promises would have
rejected and a warning would have been logged, but the test would still
have exit code 0.

Backport-PR-URL: https://github.com/nodejs/node/pull/24019
PR-URL: https://github.com/nodejs/node/pull/19650
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-11-04 12:31:03 +00:00
feugy
3babc5bb53
assert: add rejects() and doesNotReject()
Implement asynchronous equivalent for assert.throws() and
assert.doesNotThrow().

Backport-PR-URL: https://github.com/nodejs/node/pull/24019
PR-URL: https://github.com/nodejs/node/pull/18023
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-11-04 12:30:51 +00:00