Cannot stub non-existent own property

The poten­tial prob­lem could be that sinon does not mock objects with dynamically-created meth­ods through Object.prototype. To mit­i­gate such prob­lem, you can try the following :

var sinon = require('sinon');
var sandbox = sinon.sandbox.create();
sandbox.stub( FUT.prototype, "Foo", () => true );

You may also like...