Top "Mocha" questions

Mocha.

In node package.json, invoke script from another script with extra parameter, in this case add mocha watcher

in node's package.json I would like to reuse a command that I already have in a 'script'. Here is …

json node.js npm mocha
How to mock dependency classes for unit testing with mocha.js?

Given that I have two ES6 classes. This is class A: import B from 'B'; class A { someFunction(){ var dependency = …

javascript node.js unit-testing mocha
Overriding `tsconfig.json` for ts-node in mocha

Is it possible to override which tsconfig.json ts-node uses when called from mocha? My main tsconfig.json contains "module": "…

node.js mocha tsconfig
Testing rejected promise in Mocha/Chai

I have a class that rejects a promise: Sync.prototype.doCall = function(verb, method, data) { var self = this; self.client = …

javascript promise mocha bluebird chai-as-promised
How to mock e.preventDefault in react component's child

Hy, I don't know how to mock an inline function in React component's child My stack: sinon, chai, enzyme; Component …

unit-testing reactjs mocha sinon enzyme
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
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
With Supertest, can I create an alternative request with some headers set by default?

I am using Supertest with Mocha to test an API developed with Node JS. And I want to do a …

javascript node.js express mocha supertest
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
Testing asynchronous function with mocha

I want to test a asynchronous javascript function that runs in node.js and makes a simple request to a …

javascript node.js testing tdd mocha