Assert-exception
Installation
$ yarn add -D assert-exception# or $ npm install assert-exception --save-dev
Usage
without assert-exception
; assert; // pass
with assert-exception
;; ; // pass
if doesn't become the exception, it returns an empty object.
;; ; // fail//// AssertionError: # foo.js:4//// assert(throws(() => {}).message === 'foo')// | | |// | | false// Object{} undefined//
API
throws(exception)
-> Error
or {}
run the exception
, and returns the error
. if not returned error
, it returns an empty object.
;; ; // pass ; // fail
rejects(promise)
-> Promise(reason)
return the rejected
reason unless fulfill
.
;;; ;
Development
Requirement global
- NodeJS v10.6.0
- Yarn v1.8.0
git clone https://github.com/59naga/assert-exceptioncd assert-exceptionyarn yarn test