@bemoje/expected-got

Creates an error-message string with ANSI-colors to make it easy to spot in the console.

Usage no npm install needed!

<script type="module">
  import bemojeExpectedGot from 'https://cdn.skypack.dev/@bemoje/expected-got';
</script>

README

@bemoje/expected-got

Creates an error-message string with ANSI-colors to make it easy to spot in the console.

Version

NPM version

Travis CI

dependencies

Dependencies

dependencies

Stats

NPM downloads Forks

Donate

Buy Me A Beer donate button PayPal donate button

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 constructor

  • value any The value argued

Returns

string The error message string (ANSI-formatted).