4.2.0 • Published 2 years ago

it-throws v4.2.0

Weekly downloads
54
License
MIT
Repository
github
Last release
2 years ago

it-throws

Build Status npm version Node.js Version

Wrapper around assert.throws and assert.rejects.

Installation

yarn add it-throws -D

Usage

import { itThrows, itRejects } from 'it-throws';

it('Throws', () => {
  itThrows(() => {
    throw new Error('foo');
  }, 'foo');
});

it('Rejects', async () => {
  await itRejects(Promise.reject(new Error('foo')), 'foo');
});

Is equivalent to:

import * as assert from 'assert';

it('Throws', () => {
  assert.throws(
    () => {
      throw new Error('foo');
    },
    {
      message: 'foo',
    },
  );
});

it('Rejects', async () => {
  await assert.rejects(Promise.reject(new Error('foo')), {
    message: 'foo',
  });
});
4.2.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.1

5 years ago