Top "Mocha" questions

Mocha.

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
When using Sinon, how to replace stub function in a stub instance?

If I have create a instance by var a = sinon.createStubInstance(MyContructor). How can I replace one of the stubbed …

node.js mocha sinon nodeunit
global leak errors in mocha

I was trying to unit test the apple push notification library when I got a global leak error trying to …

node.js unit-testing push-notification apple-push-notifications mocha
Declare "pending" specs/tests in jasmine or mocha

I would like to describe specifications that should be in the code, but implementation of them would be added later. …

jasmine mocha
How to import "describe" and "it" from mocha in TypeScript?

By default, when importing mocha in TypeScript, it brings in describe and it (and some others) into the global namespace. …

typescript mocha
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
mocha command giving ReferenceError: window is not defined

I am using command: mocha --compilers :./test/babel-setup.js --recursive --watch It is giving error: ReferenceError: window is not defined …

node.js mocha jsdom
what's the least resistance path to debugging mocha tests?

Edit Nov 2016: Node now has a built in debugger that you can start with --inspect. This answer explains it: https://…

node.js unit-testing debugging coffeescript mocha
Mocking Window with Sinon, Mocha, Enzyme, and React

I'm trying to mock out the window object for a component I'm using with just the four libraries listed above. …

unit-testing reactjs mocha sinon
How do you test an AJAX request with RSpec/RoR?

I'm fairly new to RoR and recently started learning BDD/Rspec for testing my application. I've been looking for a …

ruby-on-rails ajax testing rspec mocha