Top "Sinon" questions

Sinon is a mocking framework for JavaScript, which can create spies, stubs and mocks.

TypeError: Attempted to wrap undefined property as function

The example below is simplified. I have a getter method: class MyClass { constructor() {} get myMethod() { return true; } } which is processed …

ecmascript-6 sinon babeljs es6-class
undefined|0|ReferenceError: Strict mode forbids implicit creation of global property 'csrf_token'

So, this was quite an interesting problem I have been running into. I am currently building a backbone.js - …

javascript ruby-on-rails backbone.js jasmine sinon
How to make Istanbul generate coverage for all of my source code?

Currently Istanbul is only generating coverage for files that are used in my tests, which is okay, but seems to …

node.js mocha sinon chai istanbul
how to unit test contents of a callback function with sinon.js

how does one test a code inside a callback function using sinon.js framework for mocking? JSFiddle: http://jsfiddle.net/…

javascript unit-testing mocha.js qunit sinon
Use sinon.js to create a "spy object" with spy methods based on a real constructor/prototype

I'm using sinon.js as a way to stub out dependencies in my Mocha tests. I prefer the 'spy' approach …

javascript node.js mocha sinon
How to spy on a default exported function

sinon.spy takes 2 parameters, object and function name. I have a module as listed below: module.exports = function xyz() { } How …

javascript node.js sinon
Invalid Chai property when calling calledOnce

I'm having problems writing tests in javascript with sinon and chai. I'm trying to check if a function is called …

javascript sinon sinon-chai
Possible to stub method twice within a single test to return different results?

I would like to re-stub someHandler.getStatus, but I'm getting TypeError: Attempted to wrap getStatus which is already wrapped .. it(…

javascript unit-testing sinon stub
Calling original function from Sinon.js Stub

I'm trying to intercept a call with Sinon.js so I can do some logging and then execute the original …

sinon
How to stub static methods with sinon in ES6?

var MyClassStub = sinon.createStubInstance(MyClass); MyClassStub doesn't contain static methods. How to fix that?

node.js sinon stub