Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai

Package Overview
Dependencies
Maintainers
1
Versions
97
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 1.9.2 to 1.10.0

2

bower.json
{
"name": "chai"
, "version": "1.9.2"
, "version": "1.10.0"
, "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic."

@@ -5,0 +5,0 @@ , "license": "MIT"

1.10.0 / 2014-11-10
==================
* Merge pull request #297 from prodatakey/noopchainfunc
* Merge pull request #300 from julienw/299-fix-getMessage-test
* Fix #299: the test is defining global variables
* Add a couple more unit tests
* Add unit tests for chained terminating property asserts
* Revise documentation wording
* Add docs for function style NOOP asserts
* Make the NOOP function a shared constant
* Merge pull request #298 from dasilvacontin/negativeZeroLogging
* why not more assertions
* added test for inspecting `-0`
* a more readable/simple condition statement, as pointed out by @keithamus
* added check for logging negative zero
* Change test to not trigger argument bug
* Allows writing lint-friendly tests
* readme: update contributors for 1.9.2
1.9.2 / 2014-09-29

@@ -3,0 +23,0 @@ ==================

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

exports.version = '1.9.2';
exports.version = '1.10.0';

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

@@ -9,2 +9,3 @@ /*!

var config = require('./config');
var NOOP = function() { };

@@ -73,2 +74,6 @@ module.exports = function (_chai, util) {

Assertion.addChainableNoop = function(name, fn) {
util.addChainableMethod(this.prototype, name, NOOP, fn);
};
Assertion.overwriteProperty = function (name, fn) {

@@ -75,0 +80,0 @@ util.overwriteProperty(this.prototype, name, fn);

@@ -189,2 +189,6 @@ /*!

*
* Can also be used as a function, which prevents some linter errors.
*
* expect('everthing').to.be.ok();
*
* @name ok

@@ -194,3 +198,3 @@ * @api public

Assertion.addProperty('ok', function () {
Assertion.addChainableNoop('ok', function () {
this.assert(

@@ -210,2 +214,6 @@ flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect(true).to.be.true();
*
* @name true

@@ -215,3 +223,3 @@ * @api public

Assertion.addProperty('true', function () {
Assertion.addChainableNoop('true', function () {
this.assert(

@@ -233,2 +241,6 @@ true === flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect(false).to.be.false();
*
* @name false

@@ -238,3 +250,3 @@ * @api public

Assertion.addProperty('false', function () {
Assertion.addChainableNoop('false', function () {
this.assert(

@@ -256,2 +268,6 @@ false === flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect(null).to.be.null();
*
* @name null

@@ -261,3 +277,3 @@ * @api public

Assertion.addProperty('null', function () {
Assertion.addChainableNoop('null', function () {
this.assert(

@@ -278,2 +294,6 @@ null === flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect(undefined).to.be.undefined();
*
* @name undefined

@@ -283,3 +303,3 @@ * @api public

Assertion.addProperty('undefined', function () {
Assertion.addChainableNoop('undefined', function () {
this.assert(

@@ -305,2 +325,6 @@ undefined === flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect(foo).to.exist();
*
* @name exist

@@ -310,3 +334,3 @@ * @api public

Assertion.addProperty('exist', function () {
Assertion.addChainableNoop('exist', function () {
this.assert(

@@ -331,2 +355,6 @@ null != flag(this, 'object')

*
* Can also be used as a function, which prevents some linter errors.
*
* expect([]).to.be.empty();
*
* @name empty

@@ -336,3 +364,3 @@ * @api public

Assertion.addProperty('empty', function () {
Assertion.addChainableNoop('empty', function () {
var obj = flag(this, 'object')

@@ -363,2 +391,8 @@ , expected = obj;

*
* Can also be used as a function, which prevents some linter errors.
*
* function test () {
* expect(arguments).to.be.arguments();
* }
*
* @name arguments

@@ -379,4 +413,4 @@ * @alias Arguments

Assertion.addProperty('arguments', checkArguments);
Assertion.addProperty('Arguments', checkArguments);
Assertion.addChainableNoop('arguments', checkArguments);
Assertion.addChainableNoop('Arguments', checkArguments);

@@ -383,0 +417,0 @@ /**

@@ -194,2 +194,5 @@ // This is (almost) directly from Node.js utils

case 'number':
if (value === 0 && (1/value) === -Infinity) {
return ctx.stylize('-0', 'number');
}
return ctx.stylize('' + value, 'number');

@@ -196,0 +199,0 @@

@@ -14,3 +14,3 @@ {

],
"version": "1.9.2",
"version": "1.10.0",
"repository": {

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

@@ -27,20 +27,23 @@ [![Chai Documentation](http://chaijs.com/public/img/chai-logo.png)](http://chaijs.com)

project : chai
repo age : 2 years, 3 months ago
commits : 756
active : 170 days
repo age : 2 years, 11 months
active : 189 days
commits : 792
files : 57
authors :
540 Jake Luer 71.4%
79 Veselin Todorov 10.4%
43 Domenic Denicola 5.7%
551 Jake Luer 69.6%
79 Veselin Todorov 10.0%
43 Domenic Denicola 5.4%
7 Joshua Perry 0.9%
6 Ruben Verborgh 0.8%
5 George Kats 0.7%
5 Jo Liss 0.7%
5 Juliusz Gonera 0.7%
5 Scott Nonnenberg 0.7%
5 leider 0.7%
5 George Kats 0.6%
5 Jo Liss 0.6%
5 Juliusz Gonera 0.6%
5 Scott Nonnenberg 0.6%
5 leider 0.6%
4 David da Silva 0.5%
4 John Firebaugh 0.5%
4 Max Edmands 0.5%
4 Nick Heiner 0.5%
4 Veselin 0.5%
4 charlierudolph 0.5%
4 josher19 0.5%

@@ -51,4 +54,4 @@ 3 Andrei Neculau 0.4%

3 Jeff Barczewski 0.4%
3 Keith Cirkel 0.4%
3 Ryunosuke SATO 0.4%
3 Veselin 0.4%
2 Bartvds 0.3%

@@ -63,2 +66,4 @@ 2 Edwin Shao 0.3%

1 Chris Connelly 0.1%
1 Chris Thompson 0.1%
1 Christopher Hiller 0.1%
1 Chun-Yi 0.1%

@@ -68,4 +73,6 @@ 1 DD 0.1%

1 Jeff Welch 0.1%
1 Julien Wajsberg 0.1%
1 Kilian Ciuffolo 0.1%
1 Luís Cardoso 0.1%
1 Martin Middel 0.1%
1 Niklas Närhinen 0.1%

@@ -79,4 +86,7 @@ 1 Paul Miller 0.1%

1 laconbass 0.1%
1 mohayonao 0.1%
1 piecioshka 0.1%
1 shinnn 0.1%
## License

@@ -83,0 +93,0 @@

# Release Notes
## 1.10.0 / 2014-11-10
The following changes are required if you are upgrading from the previous version:
- **Users:**
- No changes required
- **Plugin Developers:**
- Review `addChainableNoop` notes below.
- **Core Contributors:**
- Refresh `node_modules` folder for updated dependencies.
### Noop Function for Terminating Assertion Properties
The following assertions can now also be used in the function-call form:
* ok
* true
* false
* null
* undefined
* exist
* empty
* arguments
* Arguments
The above list of assertions are property getters that assert immediately on
access. Because of that, they were written to be used by terminating the assertion
chain with a property access.
```js
expect(true).to.be.true;
foo.should.be.ok;
```
This syntax is definitely aesthetically pleasing but, if you are linting your
test code, your linter will complain with an error something like "Expected an
assignment or function call and instead saw an expression." Since the linter
doesn't know about the property getter it assumes this line has no side-effects,
and throws a warning in case you made a mistake.
Squelching these errors is not a good solution as test code is getting to be
just as important as, if not more than, production code. Catching syntactical
errors in tests using static analysis is a great tool to help make sure that your
tests are well-defined and free of typos.
A better option was to provide a function-call form for these assertions so that
the code's intent is more clear and the linters stop complaining about something
looking off. This form is added in addition to the existing property access form
and does not impact existing test code.
```js
expect(true).to.be.true();
foo.should.be.ok();
```
These forms can also be mixed in any way, these are all functionally identical:
```js
expect(true).to.be.true.and.not.false();
expect(true).to.be.true().and.not.false;
expect(true).to.be.true.and.not.false;
```
#### Plugin Authors
If you would like to provide this function-call form for your terminating assertion
properties, there is a new function to register these types of asserts. Instead
of using `addProperty` to register terminating assertions, simply use `addChainableNoop`
instead; the arguments to both are identical. The latter will make the assertion
available in both the attribute and function-call forms and should have no impact
on existing users of your plugin.
### Community Contributions
- [#297](https://github.com/chaijs/chai/pull/297) Allow writing lint-friendly tests. [@joshperry](https://github.com/joshperry)
- [#298](https://github.com/chaijs/chai/pull/298) Add check for logging `-0`. [@dasilvacontin](https://github.com/dasilvacontin)
- [#300](https://github.com/chaijs/chai/pull/300) Fix #299: the test is defining global variables [@julienw](https://github.com/julienw)
Thank you to all who took time to contribute!
## 1.9.2 / 2014-09-29

@@ -4,0 +84,0 @@

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