Created
January 3, 2013 18:17
-
-
Save c4urself/4445562 to your computer and use it in GitHub Desktop.
Chai doesn't play nice with JS Lint's check for incorrect use of `false` and `true` -- a setting that cannot be turned off via JS Lint options. The addition of `_true` and `_false` properties to Chai fixes this making JS Lint work correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We're providing some convenience functions here as well as making sure | |
// chai tests don't fall on jshint errors by remapping true/false properties | |
chai.Assertion.addProperty('_true', function () { | |
this.assert( | |
true === this.__flags.object, | |
'expected #{this} to be true', | |
'expected #{this} to be false', | |
this.negate ? false : true | |
); | |
}); | |
chai.Assertion.addProperty('_false', function () { | |
this.assert( | |
false === this.__flags.object, | |
'expected #{this} to be false', | |
'expected #{this} to be true', | |
this.negate ? true : false | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment