chai-missing-assertions
Chai plug-in to throw errors when you attempt to use undefined assertions.
Chai is a wonderful assertion library, however, there is one fatal flaw with the beautiful syntactic-sugar that they provide with Object property assertions: If you misspell or use in incorrect one, it will act as if the assertion was true.
var chai = ; expect = chaiexpect should = chai; // Ahhhh, the beauty of property assertions. Such clean syntax.tobetrue; // -> assertion correctly does not throw an errortobefalse; // -> assertion correctly throws an error // These assertion properties do not exist.tobetruthful; // -> assertion incorrectly does not throw an errortobetreu; // -> assertion incorrectly does not throw an errortobeflase; // -> assertion incorrectly does not throw an error
Chai really should throw an error if you access an undefined property of the assertion chain. This library adds exactly that!
var chai = ; expect = chaiexpect should = chai; chai; // Ahhhh, the beauty of property assertions. Such clean syntax.tobetrue; // -> assertion correctly does not throw errortobefalse; // -> assertion correctly throws error // These assertion properties do not exist.tobetruthful; // -> assertion correctly throws an errortobetreu; // -> assertion correctly throws an errortobeflase; // -> assertion correctly throws an error