Comparing version 3.5.0 to 4.0.0-canary.1
@@ -46,3 +46,3 @@ # Contributor Code of Conduct | ||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting a project maintainer at [INSERT EMAIL ADDRESS]. All | ||
reported by contacting a project maintainer at chaijs@keithcirkel.co.uk. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
@@ -49,0 +49,0 @@ is deemed necessary and appropriate to the circumstances. Maintainers are |
@@ -215,1 +215,5 @@ # Chai Contribution Guidelines | ||
- IRC: keithamus | ||
- Lucas Fernandes da Costa | ||
- GH: [@lucasfcosta](https://github.com/lucasfcosta) | ||
- TW: [@lfernandescosta](https://twitter.com/lfernandescosta) | ||
- IRC: lucasfcosta |
@@ -6,3 +6,3 @@ module.exports = function(config) { | ||
'chai.js' | ||
, 'test/bootstrap/karma.js' | ||
, 'test/bootstrap/index.js' | ||
, 'test/*.js' | ||
@@ -9,0 +9,0 @@ ] |
@@ -31,3 +31,3 @@ var version = require('./package.json').version; | ||
config.reporters.push('saucelabs'); | ||
config.transports = [ 'xhr-polling' ]; | ||
config.captureTimeout = 300000; | ||
@@ -37,3 +37,3 @@ config.sauceLabs = { | ||
, accessKey: auth.SAUCE_ACCESS_KEY | ||
, startConnect: true | ||
, startConnect: ('TRAVIS' in process.env) === false | ||
, tags: tags | ||
@@ -40,0 +40,0 @@ , testName: 'ChaiJS' |
@@ -7,4 +7,3 @@ /*! | ||
var used = [] | ||
, exports = module.exports = {}; | ||
var used = []; | ||
@@ -15,3 +14,3 @@ /*! | ||
exports.version = '3.5.0'; | ||
exports.version = require('../package').version; | ||
@@ -33,3 +32,3 @@ /*! | ||
* | ||
* Provides a way to extend the internals of Chai | ||
* Provides a way to extend the internals of Chai. | ||
* | ||
@@ -43,7 +42,7 @@ * @param {Function} | ||
if (!~used.indexOf(fn)) { | ||
fn(this, util); | ||
fn(exports, util); | ||
used.push(fn); | ||
} | ||
return this; | ||
return exports; | ||
}; | ||
@@ -50,0 +49,0 @@ |
@@ -33,5 +33,7 @@ /*! | ||
function Assertion (obj, msg, stack) { | ||
flag(this, 'ssfi', stack || arguments.callee); | ||
flag(this, 'ssfi', stack || Assertion); | ||
flag(this, 'object', obj); | ||
flag(this, 'message', msg); | ||
return util.proxify(this); | ||
} | ||
@@ -102,8 +104,9 @@ | ||
var ok = util.test(this, arguments); | ||
if (true !== showDiff) showDiff = false; | ||
if (false !== showDiff) showDiff = true; | ||
if (undefined === expected && undefined === _actual) showDiff = false; | ||
if (true !== config.showDiff) showDiff = false; | ||
if (!ok) { | ||
var msg = util.getMessage(this, arguments) | ||
, actual = util.getActual(this, arguments); | ||
msg = util.getMessage(this, arguments); | ||
var actual = util.getActual(this, arguments); | ||
throw new AssertionError(msg, { | ||
@@ -110,0 +113,0 @@ actual: actual |
@@ -16,3 +16,3 @@ module.exports = { | ||
includeStack: false, | ||
includeStack: false, | ||
@@ -54,4 +54,43 @@ /** | ||
truncateThreshold: 40 | ||
truncateThreshold: 40, | ||
/** | ||
* ### config.useProxy | ||
* | ||
* User configurable property, defines if chai will use a Proxy to throw | ||
* an error when a non-existent property is read, which protects users | ||
* from typos when using property-based assertions. | ||
* | ||
* Set it to false if you want to disable this feature. | ||
* | ||
* chai.config.useProxy = false; // disable use of Proxy | ||
* | ||
* This feature is automatically disabled regardless of this config value | ||
* in environments that don't support proxies. | ||
* | ||
* @param {Boolean} | ||
* @api public | ||
*/ | ||
useProxy: true, | ||
/** | ||
* ### config.proxyExcludedKeys | ||
* | ||
* User configurable property, defines which properties should be ignored | ||
* instead of throwing an error if they do not exist on the assertion. | ||
* This is only applied if the environment Chai is running in supports proxies and | ||
* if the `useProxy` configuration setting is enabled. | ||
* By default, `then` and `inspect` will not throw an error if they do not exist on the | ||
* assertion object because the `.inspect` property is read by `util.inspect` (for example, when | ||
* using `console.log` on the assertion object) and `.then` is necessary for promise type-checking. | ||
* | ||
* // By default these keys will not throw an error if they do not exist on the assertion object | ||
* chai.config.proxyExcludedKeys = ['then', 'inspect']; | ||
* | ||
* @param {Array} | ||
* @api public | ||
*/ | ||
proxyExcludedKeys: ['then', 'inspect', 'toJSON'] | ||
}; |
@@ -22,3 +22,3 @@ /*! | ||
* @param {String} operator | ||
* @namespace Expect | ||
* @namespace BDD | ||
* @api public | ||
@@ -25,0 +25,0 @@ */ |
@@ -13,3 +13,6 @@ /*! | ||
function shouldGetter() { | ||
if (this instanceof String || this instanceof Number || this instanceof Boolean ) { | ||
if (this instanceof String | ||
|| this instanceof Number | ||
|| this instanceof Boolean | ||
|| typeof Symbol === 'function' && this instanceof Symbol) { | ||
return new Assertion(this.valueOf(), null, shouldGetter); | ||
@@ -52,3 +55,3 @@ } | ||
* @param {String} operator | ||
* @namespace Should | ||
* @namespace BDD | ||
* @api public | ||
@@ -55,0 +58,0 @@ */ |
@@ -11,5 +11,6 @@ /*! | ||
var chai = require('../../chai'); | ||
var flag = require('./flag'); | ||
var proxify = require('./proxify'); | ||
var transferFlags = require('./transferFlags'); | ||
var flag = require('./flag'); | ||
var config = require('../config'); | ||
@@ -83,6 +84,13 @@ /*! | ||
var old_ssfi = flag(this, 'ssfi'); | ||
if (old_ssfi && config.includeStack === false) | ||
if (old_ssfi) | ||
flag(this, 'ssfi', assert); | ||
var result = chainableBehavior.method.apply(this, arguments); | ||
return result === undefined ? this : result; | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
}; | ||
@@ -110,3 +118,3 @@ | ||
transferFlags(this, assert); | ||
return assert; | ||
return proxify(assert); | ||
} | ||
@@ -113,0 +121,0 @@ , configurable: true |
@@ -7,3 +7,6 @@ /*! | ||
var config = require('../config'); | ||
var chai = require('../../chai'); | ||
var flag = require('./flag'); | ||
var proxify = require('./proxify'); | ||
var transferFlags = require('./transferFlags'); | ||
@@ -35,12 +38,20 @@ /** | ||
*/ | ||
var flag = require('./flag'); | ||
module.exports = function (ctx, name, method) { | ||
ctx[name] = function () { | ||
var fn = function () { | ||
var keep_ssfi = flag(this, 'keep_ssfi'); | ||
var old_ssfi = flag(this, 'ssfi'); | ||
if (old_ssfi && config.includeStack === false) | ||
flag(this, 'ssfi', ctx[name]); | ||
if (!keep_ssfi && old_ssfi) | ||
flag(this, 'ssfi', fn); | ||
var result = method.apply(this, arguments); | ||
return result === undefined ? this : result; | ||
if (result !== undefined) | ||
return result; | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
}; | ||
ctx[name] = proxify(fn, name); | ||
}; |
@@ -7,4 +7,5 @@ /*! | ||
var config = require('../config'); | ||
var chai = require('../../chai'); | ||
var flag = require('./flag'); | ||
var transferFlags = require('./transferFlags'); | ||
@@ -38,10 +39,18 @@ /** | ||
module.exports = function (ctx, name, getter) { | ||
getter = getter === undefined ? new Function() : getter; | ||
Object.defineProperty(ctx, name, | ||
{ get: function addProperty() { | ||
var keep_ssfi = flag(this, 'keep_ssfi'); | ||
var old_ssfi = flag(this, 'ssfi'); | ||
if (old_ssfi && config.includeStack === false) | ||
if (!keep_ssfi && old_ssfi) | ||
flag(this, 'ssfi', addProperty); | ||
var result = getter.call(this); | ||
return result === undefined ? this : result; | ||
if (result !== undefined) | ||
return result; | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
} | ||
@@ -48,0 +57,0 @@ , configurable: true |
@@ -26,3 +26,3 @@ /*! | ||
module.exports = function (obj, types) { | ||
var obj = flag(obj, 'object'); | ||
obj = flag(obj, 'object'); | ||
types = types.map(function (t) { return t.toLowerCase(); }); | ||
@@ -38,7 +38,9 @@ types.sort(); | ||
if (!types.some(function (expected) { return type(obj) === expected; })) { | ||
var objType = type(obj).toLowerCase(); | ||
if (!types.some(function (expected) { return objType === expected; })) { | ||
throw new AssertionError( | ||
'object tested must be ' + str + ', but ' + type(obj) + ' given' | ||
'object tested must be ' + str + ', but ' + objType + ' given' | ||
); | ||
} | ||
}; |
@@ -10,3 +10,3 @@ /*! | ||
* | ||
* Returns the `actual` value for an Assertion | ||
* Returns the `actual` value for an Assertion. | ||
* | ||
@@ -13,0 +13,0 @@ * @param {Object} object (constructed Assertion) |
@@ -8,6 +8,6 @@ /*! | ||
/*! | ||
* Main exports | ||
* Dependencies that are used for multiple exports are required here only once | ||
*/ | ||
var exports = module.exports = {}; | ||
var pathval = require('pathval'); | ||
@@ -74,12 +74,6 @@ /*! | ||
/*! | ||
* Deep path value | ||
*/ | ||
exports.getPathValue = require('./getPathValue'); | ||
/*! | ||
* Deep path info | ||
*/ | ||
exports.getPathInfo = require('./getPathInfo'); | ||
exports.getPathInfo = pathval.getPathInfo; | ||
@@ -90,3 +84,3 @@ /*! | ||
exports.hasProperty = require('./hasProperty'); | ||
exports.hasProperty = pathval.hasProperty; | ||
@@ -97,3 +91,3 @@ /*! | ||
exports.getName = require('./getName'); | ||
exports.getName = require('get-func-name'); | ||
@@ -135,1 +129,37 @@ /*! | ||
exports.overwriteChainableMethod = require('./overwriteChainableMethod'); | ||
/*! | ||
* Compare by inspect method | ||
*/ | ||
exports.compareByInspect = require('./compareByInspect'); | ||
/*! | ||
* Get own enumerable property symbols method | ||
*/ | ||
exports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols'); | ||
/*! | ||
* Get own enumerable properties method | ||
*/ | ||
exports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties'); | ||
/*! | ||
* Checks error against a given set of criteria | ||
*/ | ||
exports.checkError = require('check-error'); | ||
/*! | ||
* Proxify util | ||
*/ | ||
exports.proxify = require('./proxify'); | ||
/*! | ||
* isNaN method | ||
*/ | ||
exports.isNaN = require('./isNaN'); |
// This is (almost) directly from Node.js utils | ||
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js | ||
var getName = require('./getName'); | ||
var getName = require('get-func-name'); | ||
var getProperties = require('./getProperties'); | ||
var getEnumerableProperties = require('./getEnumerableProperties'); | ||
var config = require('../config'); | ||
@@ -11,3 +12,3 @@ module.exports = inspect; | ||
/** | ||
* Echos the value of a value. Trys to print the value out | ||
* Echoes the value of a value. Tries to print the value out | ||
* in the best way possible given the different types. | ||
@@ -40,2 +41,3 @@ * | ||
typeof object === 'object' && | ||
'nodeType' in object && | ||
object.nodeType === 1 && | ||
@@ -54,3 +56,3 @@ typeof object.nodeName === 'string'; | ||
!(value.constructor && value.constructor.prototype === value)) { | ||
var ret = value.inspect(recurseTimes); | ||
var ret = value.inspect(recurseTimes, ctx); | ||
if (typeof ret !== 'string') { | ||
@@ -105,2 +107,4 @@ ret = formatValue(ctx, ret, recurseTimes); | ||
var name, nameSuffix; | ||
// Some type of object without properties can be shortcutted. | ||
@@ -114,4 +118,4 @@ // In IE, errors have a single `stack` property, or if they are vanilla `Error`, | ||
if (typeof value === 'function') { | ||
var name = getName(value); | ||
var nameSuffix = name ? ': ' + name : ''; | ||
name = getName(value); | ||
nameSuffix = name ? ': ' + name : ''; | ||
return ctx.stylize('[Function' + nameSuffix + ']', 'special'); | ||
@@ -130,4 +134,12 @@ } | ||
var base = '', array = false, braces = ['{', '}']; | ||
var base = '' | ||
, array = false | ||
, typedArray = false | ||
, braces = ['{', '}']; | ||
if (isTypedArray(value)) { | ||
typedArray = true; | ||
braces = ['[', ']']; | ||
} | ||
// Make Array say that they are Array | ||
@@ -141,4 +153,4 @@ if (isArray(value)) { | ||
if (typeof value === 'function') { | ||
var name = getName(value); | ||
var nameSuffix = name ? ': ' + name : ''; | ||
name = getName(value); | ||
nameSuffix = name ? ': ' + name : ''; | ||
base = ' [Function' + nameSuffix + ']'; | ||
@@ -179,2 +191,4 @@ } | ||
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); | ||
} else if (typedArray) { | ||
return formatTypedArray(value); | ||
} else { | ||
@@ -211,2 +225,5 @@ output = keys.map(function(key) { | ||
return ctx.stylize('' + value, 'boolean'); | ||
case 'symbol': | ||
return ctx.stylize(value.toString(), 'symbol'); | ||
} | ||
@@ -235,2 +252,3 @@ // For some reason typeof null is "object", so special case here. | ||
} | ||
keys.forEach(function(key) { | ||
@@ -245,8 +263,30 @@ if (!key.match(/^\d+$/)) { | ||
function formatTypedArray(value) { | ||
var str = '[ '; | ||
for (var i = 0; i < value.length; ++i) { | ||
if (str.length >= config.truncateThreshold - 7) { | ||
str += '...'; | ||
break; | ||
} | ||
str += value[i] + ', '; | ||
} | ||
str += ' ]'; | ||
// Removing trailing `, ` if the array was not truncated | ||
if (str.indexOf(', ]') !== -1) { | ||
str = str.replace(', ]', ' ]'); | ||
} | ||
return str; | ||
} | ||
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { | ||
var name, str; | ||
if (value.__lookupGetter__) { | ||
if (value.__lookupGetter__(key)) { | ||
if (value.__lookupSetter__(key)) { | ||
var name; | ||
var propDescriptor = Object.getOwnPropertyDescriptor(value, key); | ||
var str; | ||
if (propDescriptor) { | ||
if (propDescriptor.get) { | ||
if (propDescriptor.set) { | ||
str = ctx.stylize('[Getter/Setter]', 'special'); | ||
@@ -257,3 +297,3 @@ } else { | ||
} else { | ||
if (value.__lookupSetter__(key)) { | ||
if (propDescriptor.set) { | ||
str = ctx.stylize('[Setter]', 'special'); | ||
@@ -328,2 +368,8 @@ } | ||
function isTypedArray(ar) { | ||
// Unfortunately there's no way to check if an object is a TypedArray | ||
// We have to check if it's one of these types | ||
return (typeof ar === 'object' && /\w+Array]$/.test(objectToString(ar))); | ||
} | ||
function isArray(ar) { | ||
@@ -330,0 +376,0 @@ return Array.isArray(ar) || |
@@ -7,2 +7,5 @@ /*! | ||
var chai = require('../../chai'); | ||
var transferFlags = require('./transferFlags'); | ||
/** | ||
@@ -47,3 +50,9 @@ * ### overwriteChainableMethod (ctx, name, method, chainingBehavior) | ||
var result = chainingBehavior(_chainingBehavior).call(this); | ||
return result === undefined ? this : result; | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
}; | ||
@@ -54,4 +63,10 @@ | ||
var result = method(_method).apply(this, arguments); | ||
return result === undefined ? this : result; | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
}; | ||
}; |
@@ -7,2 +7,7 @@ /*! | ||
var chai = require('../../chai'); | ||
var flag = require('./flag'); | ||
var proxify = require('./proxify'); | ||
var transferFlags = require('./transferFlags'); | ||
/** | ||
@@ -44,3 +49,5 @@ * ### overwriteMethod (ctx, name, fn) | ||
var _method = ctx[name] | ||
, _super = function () { return this; }; | ||
, _super = function () { | ||
throw new Error(name + ' is not a function'); | ||
}; | ||
@@ -50,6 +57,22 @@ if (_method && 'function' === typeof _method) | ||
ctx[name] = function () { | ||
var fn = function () { | ||
var keep_ssfi = flag(this, 'keep_ssfi'); | ||
var old_ssfi = flag(this, 'ssfi'); | ||
if (!keep_ssfi && old_ssfi) | ||
flag(this, 'ssfi', fn); | ||
flag(this, 'keep_ssfi', true); | ||
var result = method(_super).apply(this, arguments); | ||
return result === undefined ? this : result; | ||
flag(this, 'keep_ssfi', false); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
} | ||
ctx[name] = proxify(fn, name); | ||
}; |
@@ -7,2 +7,6 @@ /*! | ||
var chai = require('../../chai'); | ||
var flag = require('./flag'); | ||
var transferFlags = require('./transferFlags'); | ||
/** | ||
@@ -50,5 +54,19 @@ * ### overwriteProperty (ctx, name, fn) | ||
Object.defineProperty(ctx, name, | ||
{ get: function () { | ||
{ get: function overwriteProperty() { | ||
var keep_ssfi = flag(this, 'keep_ssfi'); | ||
var old_ssfi = flag(this, 'ssfi'); | ||
if (!keep_ssfi && old_ssfi) | ||
flag(this, 'ssfi', overwriteProperty); | ||
flag(this, 'keep_ssfi', true); | ||
var result = getter(_super).call(this); | ||
return result === undefined ? this : result; | ||
flag(this, 'keep_ssfi', false); | ||
if (result !== undefined) { | ||
return result; | ||
} | ||
var newAssertion = new chai.Assertion(); | ||
transferFlags(this, newAssertion); | ||
return newAssertion; | ||
} | ||
@@ -55,0 +73,0 @@ , configurable: true |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "3.5.0", | ||
"version": "4.0.0-canary.1", | ||
"repository": { | ||
@@ -34,20 +34,23 @@ "type": "git", | ||
"engines": { | ||
"node": ">= 0.4.0" | ||
"node": ">=0.10" | ||
}, | ||
"dependencies": { | ||
"assertion-error": "^1.0.1", | ||
"deep-eql": "^0.1.3", | ||
"type-detect": "^1.0.0" | ||
"check-error": "^1.0.1", | ||
"deep-eql": "^1.0.3", | ||
"get-func-name": "^1.0.0", | ||
"pathval": "^1.0.0", | ||
"type-detect": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^10.2.1", | ||
"browserify": "^13.0.1", | ||
"bump-cli": "^1.1.3", | ||
"karma": "^0.13.16", | ||
"karma-mocha": "^0.1.10", | ||
"karma-sauce-launcher": "^0.2.11", | ||
"karma-phantomjs-launcher": "^0.2.0", | ||
"karma-firefox-launcher": "^0.1.6", | ||
"mocha": "^2.2.5", | ||
"istanbul": "^0.3.14" | ||
"istanbul": "^0.4.3", | ||
"karma": "^1.0.0", | ||
"karma-firefox-launcher": "^1.0.0", | ||
"karma-mocha": "^1.0.1", | ||
"karma-phantomjs-launcher": "^1.0.0", | ||
"karma-sauce-launcher": "^1.0.0", | ||
"mocha": "^3.0.0" | ||
} | ||
} |
172
README.md
@@ -1,34 +0,142 @@ | ||
[![Chai Documentation](http://chaijs.com/public/img/chai-logo.png)](http://chaijs.com) | ||
<h1 align=center> | ||
<a href="http://chaijs.com" title="Chai Documentation"> | ||
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png"/> chai | ||
</a> | ||
</h1> | ||
[![license:mit](https://img.shields.io/badge/license-mit-green.svg?style=flat-square)](#license)<br> | ||
[![tag:?](https://img.shields.io/github/tag/chaijs/chai.svg?style=flat-square)](https://github.com/chaijs/chai/releases) | ||
[![build:?](https://img.shields.io/travis/chaijs/chai/master.svg?style=flat-square)](https://travis-ci.org/chaijs/chai) | ||
[![coverage:?](https://img.shields.io/coveralls/chaijs/chai/master.svg?style=flat-square)](https://coveralls.io/r/chaijs/chai)<br> | ||
[![npm:](https://img.shields.io/npm/v/chai.svg?style=flat-square)](https://www.npmjs.com/packages/chai) | ||
[![dependencies:?](https://img.shields.io/npm/dm/chai.svg?style=flat-square)](https://www.npmjs.com/packages/chai) | ||
[![devDependencies:?](https://img.shields.io/david/chaijs/chai.svg?style=flat-square)](https://david-dm.org/chaijs/chai) | ||
<p align=center> | ||
Chai is a BDD / TDD assertion library for <a href="http://nodejs.org">node</a> and the browser that can be delightfully paired with any javascript testing framework. | ||
</p> | ||
[![Selenium Test Status](https://saucelabs.com/browser-matrix/chaijs.svg)](https://saucelabs.com/u/chaijs) | ||
<p align=center> | ||
<a href="./LICENSE"> | ||
<img | ||
alt="license:mit" | ||
src="https://img.shields.io/badge/license-mit-green.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://github.com/chaijs/chai/releases"> | ||
<img | ||
alt="tag:?" | ||
src="https://img.shields.io/github/tag/chaijs/chai.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://www.npmjs.com/packages/chai"> | ||
<img | ||
alt="node:?" | ||
src="https://img.shields.io/badge/node-%3E=0.10-blue.svg?style=flat-square" | ||
/> | ||
</a> | ||
<br/> | ||
<a href="https://saucelabs.com/u/chaijs"> | ||
<img | ||
alt="Selenium Test Status" | ||
src="https://saucelabs.com/browser-matrix/chaijs.svg" | ||
/> | ||
</a> | ||
<br/> | ||
<a href="https://www.npmjs.com/packages/chai"> | ||
<img | ||
alt="downloads:?" | ||
src="https://img.shields.io/npm/dm/chai.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://travis-ci.org/chaijs/chai"> | ||
<img | ||
alt="build:?" | ||
src="https://img.shields.io/travis/chaijs/chai/master.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://coveralls.io/r/chaijs/chai"> | ||
<img | ||
alt="coverage:?" | ||
src="https://img.shields.io/coveralls/chaijs/chai/master.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href=""> | ||
<img | ||
alt="devDependencies:?" | ||
src="https://img.shields.io/david/chaijs/chai.svg?style=flat-square" | ||
/> | ||
</a> | ||
<br/> | ||
<a href="https://chai-slack.herokuapp.com/"> | ||
<img | ||
alt="Join the Slack chat" | ||
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://gitter.im/chaijs/chai"> | ||
<img | ||
alt="Join the Gitter chat" | ||
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square" | ||
/> | ||
</a> | ||
<a href="https://opencollective.com/chaijs"> | ||
<img | ||
alt="OpenCollective Backers" | ||
src="https://opencollective.com/chaijs/backers/badge.svg?style=flat-square" | ||
/> | ||
</a> | ||
</p> | ||
[![Slack Status](https://chai-slack.herokuapp.com/badge.svg)]( https://chai-slack.herokuapp.com/) | ||
[![Join the chat at https://gitter.im/chaijs/chai](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/chaijs/chai) | ||
For more information or to download plugins, view the [documentation](http://chaijs.com). | ||
Chai is a BDD / TDD assertion library for [node](http://nodejs.org) and the browser that | ||
can be delightfully paired with any javascript testing framework. | ||
## What is Chai? | ||
For more information or to download plugins, view the [documentation](http://chaijs.com). | ||
Chai is an _assertion library_, similar to Node's build in `assert`. It makes testing much easier by giving you lots of assertions you can run against your code. | ||
### Plugins | ||
## Installation | ||
### Node.js | ||
`chai` is available on [npm](http://npmjs.org). To install it, type: | ||
$ npm install chai | ||
### Browsers | ||
You can also use it within the browser; install via npm and use the `chai.js` file found within the download. For example: | ||
```html | ||
<script src="./node_modules/chai/chai.js"></script> | ||
``` | ||
## Usage | ||
Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`: | ||
```js | ||
var chai = require('chai'); | ||
// Using Assert style | ||
var assert = chai.assert; | ||
// Using Expect style | ||
var expect = chai.expect; | ||
// Using Should style | ||
var should = chai.should(); | ||
``` | ||
[Read more about these styles in our docs](http://chaijs.com/guide/styles/). | ||
## Plugins | ||
Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces. | ||
- Need a plugin? View the [official plugin list](http://chaijs.com/plugins). | ||
- Have a plugin and want it listed? Open a Pull Request at [chaijs/chai-docs:plugin.js](https://github.com/chaijs/chai-docs/blob/master/plugins.js#L1-L12). | ||
- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/). | ||
- Have a plugin and want it listed? Simply add the following keywords to your package.json: | ||
- `chai-plugin` | ||
- `browser` if your plugin works in the browser as well as Node.js | ||
- `browser-only` if your plugin does not work with Node.js | ||
### Related Projects | ||
- [chaijs / chai-docs](https://github.com/chaijs/chai-docs): The chaijs.com website source code. | ||
- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing. | ||
- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser. | ||
- [chaijs / type-detect](https://github.com/chaijs/type-detect): Improved typeof detection for node.js and the browser. | ||
- [chaijs / type-detect](https://github.com/chaijs/type-detect): Improved typeof detection for Node.js and the browser. | ||
- [chaijs / check-error](https://github.com/chaijs/check-error): Error comparison and information related utility for Node.js and the browser. | ||
- [chaijs / loupe](https://github.com/chaijs/loupe): Inspect utility for Node.js and browsers. | ||
- [chaijs / pathval](https://github.com/chaijs/pathval): Object value retrieval given a string path. | ||
- [chaijs / get-func-name](https://github.com/chaijs/get-func-name): Utility for getting a function's name for node and the browser. | ||
@@ -39,2 +147,4 @@ ### Contributing | ||
Please make sure you follow our [Code Of Conduct](https://github.com/chaijs/chai/blob/master/CODE_OF_CONDUCT.md) and we also strongly recommend reading our [Contributing Guide](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md). | ||
Here are a few issues other contributors frequently ran into when opening pull requests: | ||
@@ -45,4 +155,2 @@ | ||
We also strongly encourage you to read our detailed [contribution guidelines](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md). | ||
### Contributors | ||
@@ -62,25 +170,3 @@ | ||
[![Keith Cirkel](https://avatars3.githubusercontent.com/u/118266?v=3&s=50)](https://github.com/keithamus) | ||
## License | ||
(The MIT License) | ||
Copyright (c) 2011-2015 Jake Luer <jake@alogicalparadox.com> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
[![Lucas Fernandes da Costa](https://avatars3.githubusercontent.com/u/6868147?v=3&s=50)](https://github.com/lucasfcosta) | ||
[![Grant Snodgrass](https://avatars3.githubusercontent.com/u/17260989?v=3&s=50)](https://github.com/meeber) |
@@ -15,22 +15,13 @@ | ||
/*! | ||
* TODO: Karma doesn't seem to like this, though sauce boots its up | ||
* | ||
exports['SL_Firefox'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'firefox' | ||
}; | ||
exports['SL_Firefox_23'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'firefox' | ||
, platform: 'Windows XP' | ||
, version: '23' | ||
}; | ||
exports['SL_Firefox_ESR'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'firefox' | ||
, version: 38 | ||
}; | ||
*/ | ||
exports['SL_Firefox_22'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'firefox' | ||
, platform: 'Windows 7' | ||
, version: '22' | ||
}; | ||
/*! | ||
@@ -40,16 +31,7 @@ * Opera | ||
exports['SL_Opera_12'] = { | ||
exports['SL_Opera'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'opera' | ||
, platform: 'Windows 7' | ||
, version: '12' | ||
}; | ||
exports['SL_Opera_11'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'opera' | ||
, platform: 'Windows 7' | ||
, version: '11' | ||
}; | ||
/*! | ||
@@ -59,9 +41,18 @@ * Internet Explorer | ||
exports['SL_IE_10'] = { | ||
exports['SL_IE'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'internet explorer' | ||
, platform: 'Windows 2012' | ||
, version: '10' | ||
}; | ||
exports['SL_IE_Old'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'internet explorer' | ||
, version: 10 | ||
}; | ||
exports['SL_Edge'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'microsoftedge' | ||
}; | ||
/*! | ||
@@ -71,16 +62,8 @@ * Safari | ||
exports['SL_Safari_6'] = { | ||
exports['SL_Safari'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'safari' | ||
, platform: 'Mac 10.8' | ||
, version: '6' | ||
, platform: 'Mac 10.11' | ||
}; | ||
exports['SL_Safari_5'] = { | ||
base: 'SauceLabs' | ||
, browserName: 'safari' | ||
, platform: 'Mac 10.6' | ||
, version: '5' | ||
}; | ||
/*! | ||
@@ -87,0 +70,0 @@ * iPhone |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
573634
44
14804
170
6
1
11
2
+ Addedcheck-error@^1.0.1
+ Addedget-func-name@^1.0.0
+ Addedpathval@^1.0.0
+ Addedcheck-error@1.0.3(transitive)
+ Addeddeep-eql@1.0.3(transitive)
+ Addedget-func-name@1.0.02.0.2(transitive)
+ Addedpathval@1.1.1(transitive)
+ Addedtype-detect@3.0.04.1.0(transitive)
- Removeddeep-eql@0.1.3(transitive)
- Removedtype-detect@0.1.11.0.0(transitive)
Updateddeep-eql@^1.0.3
Updatedtype-detect@^4.0.0