chai
chai copied to clipboard
BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
If there is going to be magic like `expect.to.be.true` (without the `()` on true), then it is surprising that `expect(false)` is not equivalent to `expect(false).to.equal(true)`. Your test will pass if...
Following test case passes ```javascript expect({ x: 'foo', y: 'bar' }).to.not.have.key('y'); ``` That doesn't seem expected. Repl.it: https://repl.it/@medikoo/chai-not-have-keys-issue#index.js
**Case:** ``` isObject(global.console, '...'); // Node 14.17.0 => FALSE isObject(global.console, '...'); // Node 12.19.0 => TRUE ``` **Cause:** ``` global.console.toString(); // Node 14.17.0 => '[object console]' global.console.toString(); // Node 12.19.0...
Chai's API reference (https://www.chaijs.com/api/bdd/ and https://www.chaijs.com/api/assert/) probably contains everything you need to know on how to write test cases using Chai. But if you're not familiar with Chai, it's difficult...
I'm trying to use `chai` as ES6 module in browser environment directly (no babel and no bundler) and it doesn't work, I must be missing something. What I've tried: The...
This code: ```js assert.equal(res.length, 5); ``` could be rewrote to: ```js assert.lengthOf(res, 5); ``` And it is short and graceful. --- But this code: ```js assert.equal(res.length, res2.length); ``` could be...
Right now, pretty-printing of objects is hard-coded to stop at a depth of 2. There already is a configuration of the truncation threshold for the length of the string via...
Reproduce code: https://runkit.com/embed/vnc5o0xboic8 But it works when I use [deep-eql](https://github.com/chaijs/deep-eql) package directly, code: https://runkit.com/embed/p74ljbrttuxq Does `chai` use `deep-eql`? If it does, is this a bug?
I think, this is a good idea to warn because when someone types lots of ordinary `.should` assertions ``` message.id.should.be.equal(...); message.user_id.should.be.equal(...); ``` and then suddenly they need to insert `expect()`...
``` expect(new Error('abc')).to.be.an('error').that.include({ message: 'abc' }) ``` returns "object tested must be an array, an object, or a string, but error given" (assuming updated error message for the latest chai...