Top "Chai" questions

Chai is a BDD/TDD assertion library for Node.

mocha, chai, Uncaught AssertionError: expected {} to equal {} + expected - actual

it('GET /customers/ with wrong id', (done) => { request .get(`/customers/${wrongId}`) .end((err, res) => { expect(res.body).to.…

mocha chai
Trying ES6 style import gives 'Cannot use import statement outside a module'

I am trying to write a javascript test in intellij for which I need to import some dependancies and I …

javascript intellij-idea mocha chai
Working with global window variable in mocha js from node

I am new to js unit testing and I am trying to use mocha for my backbone contact manager tutorial …

javascript node.js backbone.js mocha chai
Mocha not exiting after test

I'm starting with tests in Node. Using mocha, chai and nock (to intercept external HTTP api calls). I have written 3 …

node.js mocha chai
TypeError: Cannot read property 'equal' of undefined

I am trying to use enzyme to assert DOM nodes. My Component looks like import React, {Component} from 'react'; import …

javascript reactjs jestjs enzyme chai
Error: [$injector:unpr] Unknown provider: $stateProvider <- $state

Executing below unit test gives "Error: [$injector:unpr] Unknown provider: $stateProvider <- $state". I have attached the angular-ui-router.min.…

arrays angularjs unit-testing mocha chai
How to do an "or" in chai should

How do I do an or test with chai.should? e.g. something like total.should.equal(4).or.equal(5) or …

chai
Failing test displays "Error: timeout of 2000ms exceeded" when using Sinon-Chai

I have the following route (express) for which I'm writing an integration test. Here's the code: var q = require("q"), …

node.js unit-testing mocha sinon chai
Match partial objects in Chai assertions?

I am looking for the best way to match the following: expect([ { C1: 'xxx', C0: 'this causes it not to …

chai
Chai unittesting - expect(42).to.be.an('integer')

According to http://chaijs.com/api/bdd/#a, a/an can be used to check for the type of a …

javascript node.js unit-testing mocha chai