Skip to content

assert: improve assert rejects

Commit 1 (assert: add direct promises support in rejects):

This adds direct promise support to `assert.rejects` and
`assert.doesNotReject`. It will now accept both, functions and ES2015
promises as input.

Besides this the documentation was updated to reflect the latest
changes.

It also refactors the tests to a non blocking way to improve the
execution performance and improves the coverage.

Commit 2 (tools: add eslintrc rule for assert.rejects):

This makes sure `assert.rejects` is always called with a second
argument. Besides that it is also changes a eslint error message
to suggest objects instead of a regular expression.

Commit 3 (doc: improve assert documentation):

This adds a example to `assert.throws` to document checking against
error instances. It also makes it clearer what some arguments can
receive as input.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading