Please sign in to comment.
assert: improve assert.fail() API
assert.fail() has two possible function signatures, both of which are not intuitive. It virtually guarantees that people who try to use assert.fail() without carefully reading the docs will end up using it incorrectly. This change maintains backwards compatibility with the two valid uses (arguments 1 2 and 4 supplied but argument 3 falsy, and argument 3 supplied but arguments 1 2 and 4 all falsy) but also adds the far more intuitive first-argument-only and first-two-arguments-only possibilities. assert.fail('boom'); // AssertionError: boom assert.fail('a', 'b'); // AssertionError: 'a' != 'b' Backport-PR-URL: #15479 PR-URL: #12293 Reviewed-By: Anna Henningsen <firstname.lastname@example.org> Reviewed-By: Michaël Zasso <email@example.com> Reviewed-By: James M Snell <firstname.lastname@example.org>
- Loading branch information...
Showing with 42 additions and 1 deletion.