@bemoje/expected-got
v1.0.1
Published
Creates an error-message string with ANSI-colors to make it easy to spot in the console.
Downloads
21
Maintainers
Readme
@bemoje/expected-got
Creates an error-message string with ANSI-colors to make it easy to spot in the console.
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/expected-got
npm install --save @bemoje/expected-got
npm install --save-dev @bemoje/expected-got
Usage
import expectedGot from '@bemoje/expected-got'
const shouldBeString = 75
const shouldBeNumberOrRegExp = 'asd'
expectedGot(String, shouldBeString)
//=> 'Expected String, got Number'
expectedGot([Number, RegExp], shouldBeNumberOrRegExp)
//=> 'Expected Number, RegExp, got String'
Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
API
expectedGot
Creates an error-message string with ANSI-colors to make it easy to spot in the console.
Parameters
constructor
function The expected type's constructorvalue
any The value argued
Returns
string The error message string (ANSI-formatted).