This package has been deprecated

Author message:

see builtin node modules

@kingjs/assert-throws

1.0.6 • Public • Published

@kingjs/assert-throws

Throw an exception if a function fails to throw an exception.

Usage

Assert that a function throws an exception like this:

var assertThrows = require('@kingjs/assert-throws');
assertThrows(function() { });

throws:

"An assertion failed."

Provide a more descriptive error message like this:

var assertThrows = require('@kingjs/assert-throws');

assertThrows(
  function() { }, 
  "Expected an exception, but actually passed."
) 

throws:

"Expected an exception, but actually passed."

API

declare function assertThrows(func: Function, message?: string);

Parameters

func: Function expected to throw an exception.

message: Message to throw if func fails to throw an exception, else will throw "An assertion failed.".

Install

With npm installed, run

$ npm install @kingjs/assert-throws

License

MIT

Analytics

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/assert-throws

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

3.06 kB

Total Files

4

Last publish

Collaborators

  • kingces95