Cannot stub non-existent own property

The potential problem could be that sinon does not mock objects with dynamically-created methods through Object.prototype. To mitigate such problem, you can try the following :

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

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *