Creates an error-message string with ANSI-colors to make it easy to spot in the console.
npm install @bemoje/expected-got
npm install --save @bemoje/expected-got
npm install --save-dev @bemoje/expected-got
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'
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
Creates an error-message string with ANSI-colors to make it easy to spot in the console.
-
constructor
function The expected type's constructor -
value
any The value argued
string The error message string (ANSI-formatted).