Socket
Socket
Sign inDemoInstall

expect

Package Overview
Dependencies
Maintainers
1
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

.jshintignore

21

modules/expect.js

@@ -13,3 +13,4 @@ var assert = require('assert');

var args = Array.prototype.slice.call(arguments, 0);
return assertion.apply(assert, [ this.actual ].concat(args));
assertion.apply(assert, [ this.actual ].concat(args));
return this;
};

@@ -53,2 +54,14 @@ }

Expectation.prototype.toExist = function (message) {
message = message || inspect(this.actual) + ' should exist';
assert(this.actual, message);
return this;
};
Expectation.prototype.toNotExist = function (message) {
message = message || inspect(this.actual) + ' should not exist';
assert(!this.actual, message);
return this;
};
Expectation.prototype.toBeA = function (constructor, message) {

@@ -58,2 +71,3 @@ assert(isFunction(constructor), 'The constructor used in toBeA/toBeAn must be a function');

assert(this.actual instanceof constructor, message);
return this;
};

@@ -65,2 +79,3 @@

assert(pattern.test(this.actual), message);
return this;
};

@@ -71,2 +86,3 @@

assert(this.actual < value, message);
return this;
};

@@ -77,2 +93,3 @@

assert(this.actual > value, message);
return this;
};

@@ -94,2 +111,3 @@

);
return this;
};

@@ -111,2 +129,3 @@

);
return this;
};

@@ -113,0 +132,0 @@

2

package.json
{
"name": "expect",
"version": "1.0.2",
"version": "1.1.0",
"description": "Write better assertions",

@@ -5,0 +5,0 @@ "main": "modules/expect.js",

@@ -1,2 +0,5 @@

[![build status](https://secure.travis-ci.org/mjackson/expect.png)](http://travis-ci.org/mjackson/expect)
[![npm package](https://img.shields.io/npm/v/expect.svg?style=flat-square)](https://www.npmjs.org/package/expect)
[![build status](https://img.shields.io/travis/mjackson/expect.svg?style=flat-square)](https://travis-ci.org/mjackson/expect)
[![dependency status](https://img.shields.io/david/mjackson/expect.svg?style=flat-square)](https://david-dm.org/mjackson/expect)
[![code climate](https://img.shields.io/codeclimate/github/mjackson/expect.svg?style=flat-square)](https://codeclimate.com/github/mjackson/expect)

@@ -39,2 +42,18 @@ [expect](https://github.com/mjackson/expect) is a thin wrapper around node's [assert](http://nodejs.org/api/assert.html) module that lets you write better assertions.

#### expect(object).toExist([message])
Asserts the given `object` is truthy.
```js
expect('something truthy').toExist();
```
#### expect(object).toNotExist([message])
Asserts the given `object` is falsy.
```js
expect(null).toNotExist();
```
#### expect(object).toBeA(constructor, [message])

@@ -88,2 +107,13 @@

### Chaining Assertions
Every assertion returns an `Expectation` object, so you can chain assertions together.
```js
expect(3.14)
.toExist()
.toBeLessThan(4)
.toBeGreaterThan(3);
```
### Installation

@@ -90,0 +120,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc