1.0.3 • Published 3 years ago

@hitorisensei/jest-assert-with v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

jest-assert-type

Adds toAssertWith method to jest that allows assert check with a provided function.

Test will fail if provided function throws.

Message is created by casing thrown exception to String.

Setup

TypeScript

import the package in you test suite

import '@hitorisensei/jest-assert-with';

this ensures that jest namespace is properly extended and toAssertWith is visible to TypeScript

JavaScript

You can use one of two ways

add setupFilesAfterEnv to jest config

{
  "setupFilesAfterEnv": [
    "@hitorisensei/jest-assert-with/index.ts"
  ]
}

or import in you test suite

import '@hitorisensei/jest-assert-with';

Why

Made for use with typescript-is createAssertType and createAssertEquals functions.

This allows testing values against TypeScript types.

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago