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 0.1.0 to 0.1.1

23

expect.js
var assert = require('assert');
var util = require('util');
var inspect = util.inspect;
var isRegExp = util.isRegExp;
var isArray = Array.isArray;

@@ -10,10 +12,3 @@ module.exports = Expectation;

* in a more natural style, without the need to remember the order of arguments.
* This helps prevent you from making mistakes when writing tests. For example,
* instead of writing:
*
* assert.equal(actual, expected, [message])
*
* you can write
*
* expect(actual).toEqual(expected, [message])
* This helps prevent you from making mistakes when writing tests.
*/

@@ -44,3 +39,3 @@ function Expectation(actual) {

function toBeA(constructor, message) {
assert(typeof constructor === 'function', 'The constructor used in toBeA must be a function');
assert(isFunction(constructor), 'The constructor used in toBeA/toBeAn must be a function');
message = message || inspect(this.actual) + ' is not a ' + (constructor.name || constructor.toString());

@@ -52,3 +47,3 @@ assert(this.actual instanceof constructor, message);

function toMatch(pattern, message) {
assert(util.isRegExp(pattern), 'The pattern used in toMatch must be a RegExp');
assert(isRegExp(pattern), 'The pattern used in toMatch must be a RegExp');
message = message || inspect(this.actual) + ' does not match ' + inspect(pattern);

@@ -75,3 +70,3 @@ assert(pattern.test(this.actual), message);

function toInclude(value, comparator, message) {
assert(Array.isArray(this.actual), 'The actual value used in toContain/toInclude must be an Array');
assert(isArray(this.actual), 'The actual value used in toInclude/toContain must be an Array');

@@ -90,3 +85,3 @@ if (typeof comparator === 'string') {

function toExclude(value, comparator, message) {
assert(Array.isArray(this.actual), 'The actual value used in toNotContain/toExclude must be an Array');
assert(isArray(this.actual), 'The actual value used in toExclude/toNotContain must be an Array');

@@ -117,1 +112,5 @@ if (typeof comparator === 'string') {

}
function isFunction(object) {
return typeof object === 'function';
}
{
"name": "expect",
"version": "0.1.0",
"description": "Expect-style assertions for node",
"version": "0.1.1",
"description": "Write better assertions",
"main": "expect.js",
"directories": {
"test": "test"
},
"dependencies": {},

@@ -14,3 +11,3 @@ "devDependencies": {

"scripts": {
"test": "mocha"
"test": "mocha spec"
},

@@ -17,0 +14,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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