Socket
Socket
Sign inDemoInstall

chai

Package Overview
Dependencies
Maintainers
2
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

2

lib/chai.js

@@ -14,3 +14,3 @@ /*!

exports.version = '3.2.0';
exports.version = '3.3.0';

@@ -17,0 +17,0 @@ /*!

@@ -217,3 +217,3 @@ /*!

} else {
expected = obj && ~obj.indexOf(val);
expected = (obj != undefined) && ~obj.indexOf(val);
}

@@ -396,13 +396,4 @@ this.assert(

Assertion.addProperty('empty', function () {
var obj = flag(this, 'object')
, expected = obj;
if (Array.isArray(obj) || 'string' === typeof object) {
expected = obj.length;
} else if (typeof obj === 'object') {
expected = Object.keys(obj).length;
}
this.assert(
!expected
Object.keys(Object(flag(this, 'object'))).length === 0
, 'expected #{this} to be empty'

@@ -1443,3 +1434,3 @@ , 'expected #{this} not to be empty'

}
Assertion.addMethod('satisfy', satisfy);

@@ -1654,3 +1645,3 @@ Assertion.addMethod('satisfies', satisfy);

*
* Asserts that the target is extensible (can have new properties added to
* Asserts that the target is extensible (can have new properties added to
* it).

@@ -1674,4 +1665,18 @@ *

// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
// In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible
// The following provides ES6 behavior when a TypeError is thrown under ES5.
var isExtensible;
try {
isExtensible = Object.isExtensible(obj);
} catch (err) {
if (err instanceof TypeError) isExtensible = false;
else throw err;
}
this.assert(
Object.isExtensible(obj)
isExtensible
, 'expected #{this} to be extensible'

@@ -1702,4 +1707,18 @@ , 'expected #{this} to not be extensible'

// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
// In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true.
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed
// The following provides ES6 behavior when a TypeError is thrown under ES5.
var isSealed;
try {
isSealed = Object.isSealed(obj);
} catch (err) {
if (err instanceof TypeError) isSealed = true;
else throw err;
}
this.assert(
Object.isSealed(obj)
isSealed
, 'expected #{this} to be sealed'

@@ -1728,4 +1747,18 @@ , 'expected #{this} to not be sealed'

// In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
// In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true.
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen
// The following provides ES6 behavior when a TypeError is thrown under ES5.
var isFrozen;
try {
isFrozen = Object.isFrozen(obj);
} catch (err) {
if (err instanceof TypeError) isFrozen = true;
else throw err;
}
this.assert(
Object.isFrozen(obj)
isFrozen
, 'expected #{this} to be frozen'

@@ -1735,3 +1768,2 @@ , 'expected #{this} to not be frozen'

});
};

@@ -228,12 +228,12 @@ /*!

/**
* ### .isTrue(value, [message])
/**
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
*
* Asserts that `value` is true.
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
*
* var teaServed = true;
* assert.isTrue(teaServed, 'the tea has been served');
* assert.isAbove(5, 2, '5 is strictly greater than 2');
*
* @name isTrue
* @param {Mixed} value
* @name isAbove
* @param {Mixed} valueToCheck
* @param {Mixed} valueToBeAbove
* @param {String} message

@@ -248,11 +248,12 @@ * @api public

/**
* ### .isAbove(valueToCheck, valueToBeAbove, [message])
* ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
*
* Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
* Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`
*
* assert.isAbove(5, 2, '5 is strictly greater than 2');
* assert.isAtLeast(5, 2, '5 is greater or equal to 2');
* assert.isAtLeast(3, 3, '3 is greater or equal to 3');
*
* @name isAbove
* @name isAtLeast
* @param {Mixed} valueToCheck
* @param {Mixed} valueToBeAbove
* @param {Mixed} valueToBeAtLeast
* @param {String} message

@@ -262,4 +263,4 @@ * @api public

assert.isBelow = function (val, blw, msg) {
new Assertion(val, msg).to.be.below(blw);
assert.isAtLeast = function (val, atlst, msg) {
new Assertion(val, msg).to.be.least(atlst);
};

@@ -281,2 +282,39 @@

assert.isBelow = function (val, blw, msg) {
new Assertion(val, msg).to.be.below(blw);
};
/**
* ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
*
* Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`
*
* assert.isAtMost(3, 6, '3 is less than or equal to 6');
* assert.isAtMost(4, 4, '4 is less than or equal to 4');
*
* @name isAtMost
* @param {Mixed} valueToCheck
* @param {Mixed} valueToBeAtMost
* @param {String} message
* @api public
*/
assert.isAtMost = function (val, atmst, msg) {
new Assertion(val, msg).to.be.most(atmst);
};
/**
* ### .isTrue(value, [message])
*
* Asserts that `value` is true.
*
* var teaServed = true;
* assert.isTrue(teaServed, 'the tea has been served');
*
* @name isTrue
* @param {Mixed} value
* @param {String} message
* @api public
*/
assert.isTrue = function (val, msg) {

@@ -287,2 +325,20 @@ new Assertion(val, msg).is['true'];

/**
* ### .isNotTrue(value, [message])
*
* Asserts that `value` is not true.
*
* var tea = 'tasty chai';
* assert.isNotTrue(tea, 'great, time for tea!');
*
* @name isNotTrue
* @param {Mixed} value
* @param {String} message
* @api public
*/
assert.isNotTrue = function (val, msg) {
new Assertion(val, msg).to.not.equal(true);
};
/**
* ### .isFalse(value, [message])

@@ -306,2 +362,20 @@ *

/**
* ### .isNotFalse(value, [message])
*
* Asserts that `value` is not false.
*
* var tea = 'tasty chai';
* assert.isNotFalse(tea, 'great, time for tea!');
*
* @name isNotFalse
* @param {Mixed} value
* @param {String} message
* @api public
*/
assert.isNotFalse = function (val, msg) {
new Assertion(val, msg).to.not.equal(false);
};
/**
* ### .isNull(value, [message])

@@ -308,0 +382,0 @@ *

@@ -7,2 +7,5 @@ /*!

var config = require('../config');
var flag = require('./flag');
/**

@@ -35,3 +38,7 @@ * ### addProperty (ctx, name, getter)

Object.defineProperty(ctx, name,
{ get: function () {
{ get: function addProperty() {
var old_ssfi = flag(this, 'ssfi');
if (old_ssfi && config.includeStack === false)
flag(this, 'ssfi', addProperty);
var result = getter.call(this);

@@ -38,0 +45,0 @@ return result === undefined ? this : result;

@@ -20,3 +20,3 @@ {

],
"version": "3.2.0",
"version": "3.3.0",
"repository": {

@@ -23,0 +23,0 @@ "type": "git",

Sorry, the diff of this file is too big to display

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