Top "Chai" questions

Chai is a BDD/TDD assertion library for Node.

Fail a test with Chai.js

In JUnit you can fail a test by doing: fail("Exception not thrown"); What's the best way to achieve the …

javascript node.js chai
Nice way to get rid of no-unused-expressions linter error with chai

In my Chai tests I often find myself wanting to use their assertions that are something like .to.be.empty, .…

chai eslint
How to test react-router with enzyme

I am using enzyme+mocha+chai to test my react-redux project. Enzyme provides shallow to test component behavior. But I …

reactjs mocha react-router chai enzyme
TypeScript: Could not find a declaration file for module in unit tests, only

I'm using TypeScript with Visual Studio Code on Windows 10 to develop an NPM module. I use mocha/chai combined with …

node.js typescript mocha.js chai nyc
Add custom http headers to chai requests

I am building an app using node.js and testing with mocha + chai. Is there a way I can add …

node.js testing request chai
How to test event emitters in node

Lets say I want to write this simple task. But I want to write a test validating that: This task …

javascript node.js mocha chai
Mocha, Chai: Assert that Object is included in an Array of Objects

Chai has a nice way to assert if an Array includes a certain element expect([1,2,3]).to.include(2); What I would …

javascript testing mocha chai
How to unit test a method which connects to mongo, without actually connecting to mongo?

I'm trying to write a test to test a method that connects to mongo, but I don't actually want to …

node.js mongodb mocha chai chai-as-promised
Chai.js: Object contains/includes

Chai has an include method. I want to test to see if an object contains another object. For example: var …

javascript arrays object tdd chai
Reset "called" Count on Sinon Spy

How do I reset the "called" count on a Sinon spy before each test? Here's what I'm doing now: beforeEach(…

javascript unit-testing mocha sinon chai