# expressive-assertion

> Expressive assertions for JavaScript.

Latest version **1.5.1** (published 2015-05-07) · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install expressive-assertion
pnpm add expressive-assertion
yarn add expressive-assertion
bun add expressive-assertion
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2015-05-07 |
| First published | 2014-12-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Clemens Akens |
| Maintainers | clebert |
| Keywords | assert, test, bdd, tdd |

## Links

- npm: https://www.npmjs.com/package/expressive-assertion
- Repository: https://github.com/clebert/expressive-assertion
- Homepage: https://github.com/clebert/expressive-assertion#readme
- Issues: https://github.com/clebert/expressive-assertion/issues
- npm.io page: https://npm.io/package/expressive-assertion

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2015-05-07
- 1.5.0 — 2015-05-06
- 1.4.1 — 2015-01-24
- 1.4.0 — 2015-01-23
- 1.3.0 — 2015-01-21
- 1.2.0 — 2015-01-02
- 1.1.0 — 2014-12-25
- 1.0.0 — 2014-12-21
- 0.1.0 — 2014-12-03

## README

# expressive-assertion

> Expressive assertions for JavaScript.

[![license](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/clebert/expressive-assertion/master/LICENSE)
[![npm](http://img.shields.io/npm/v/expressive-assertion.svg?style=flat)](https://www.npmjs.org/package/expressive-assertion)
[![downloads](http://img.shields.io/npm/dm/expressive-assertion.svg?style=flat)](https://www.npmjs.org/package/expressive-assertion)

[![build](http://img.shields.io/travis/clebert/expressive-assertion/master.svg?style=flat)](https://travis-ci.org/clebert/expressive-assertion)
[![code climate coverage](http://img.shields.io/codeclimate/coverage/github/clebert/expressive-assertion.svg?style=flat)](https://codeclimate.com/github/clebert/expressive-assertion/coverage)
[![code climate](http://img.shields.io/codeclimate/github/clebert/expressive-assertion.svg?style=flat)](https://codeclimate.com/github/clebert/expressive-assertion)
[![dependencies](http://img.shields.io/david/clebert/expressive-assertion.svg?style=flat)](https://david-dm.org/clebert/expressive-assertion#info=dependencies&view=table)
[![devDependencies](http://img.shields.io/david/dev/clebert/expressive-assertion.svg?style=flat)](https://david-dm.org/clebert/expressive-assertion#info=devDependencies&view=table)

[![Sauce Test Status](https://saucelabs.com/browser-matrix/clebert1.svg)](https://saucelabs.com/u/clebert1)

## Getting Started

### Installation

```sh
npm install expressive-assertion --save
```

### Integration

```javascript
var assert = require('expressive-assertion');
```

## API

### assert(predicate, [...])

```javascript
assert(function () {
    return true;
}); // OK

assert(function () {
    return false;
}); // AssertionError: assert(function () { return false; })

assert(function () {
    return true;
}, function () {
    return true;
}); // OK

assert(function () {
    return true;
}, function () {
    return false;
}); // AssertionError: assert(function () { return false; })
```

### assert.throws(block, [predicate], [...])

```javascript
assert.throws(function () {
    throw 'foo';
}); // OK

assert.throws(function () {
    return 'foo';
}); // AssertionError: Missing expected exception.

assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}); // OK

assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception !== 'foo';
}); // AssertionError: assert(function (exception) { return exception !== 'foo'; })

assert.throws(function () {
    return 'foo';
}, function (exception) {
    return exception === 'foo';
}); // AssertionError: Missing expected exception.

assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'bar';
}); // OK

assert.throws(function () {
    throw 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'foo';
}); // AssertionError: assert(function (exception) { return exception !== 'foo'; })

assert.throws(function () {
    return 'foo';
}, function (exception) {
    return exception === 'foo';
}, function (exception) {
    return exception !== 'bar';
}); // AssertionError: Missing expected exception.
```

## Running Tests

To run the test suite first install the development dependencies:

```sh
npm install
```

then run the tests:

```sh
npm test
```

---
_Source: https://npm.io/package/expressive-assertion · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
