Top "Mocha" questions

Mocha.

Mocha beforeEach vs before execution

I ran into a problem recently that I can't explain. I have alot of code in these tests so I'm …

node.js mocha
How can I mock the imports of an ES6 module?

I have the following ES6 modules: File network.js export function getDataFromServer() { return ... } File widget.js import { getDataFromServer } from 'network.…

javascript unit-testing mocha ecmascript-6
Mongoose & unique field

I have the following schema with mongoose: var SimSchema = new Schema({ msisdn : { type : String , unique : true, required : true }, imsi : { type : …

mongodb mongoose mocha
Mocha API Testing: getting 'TypeError: app.address is not a function'

My Issue I've coded a very simple CRUD API and I've started recently coding also some tests using chai and …

javascript node.js express mocha chai
For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves

I have this test of nodejs when testing I get a error of done function not declared. Error: Timeout of 2000…

node.js mocha
How can I solve "ReferenceError: expect is not defined" error message?

I am trying to test Javascript with mocha. I've this snippet of code: describe('Array', function() { describe('indexOf()', function() { …

javascript node.js mocha
The difference between assert.equal and assert.deepEqual in Javascript testing with Mocha?

I'm using Mocha to test a small module in my Express.js application. In this module, one of my functions …

javascript arrays testing mocha
Unit testing of private functions with Mocha and Node.js

I am using Mocha in order to unit test an application written for Node.js. I wonder if it's possible …

javascript node.js unit-testing private mocha
How to assert not null?

I'm very new in javascript testing, I would like to know how to assert not null in Mocha framework.

javascript node.js mocha
Async function in mocha before() is alway finished before it() spec?

I have a callback function in before() which is for cleaning database. Is everything in before() guaranteed to finish before …

javascript asynchronous mocha