Monthly Archive: December 2016


Attempted to wrap undefined property as function

The poten­tial prob­lem could be that your methods are dynamically-created meth­ods through Object.prototype. If that’s the case then, you can try the following : sinon.stub(FUT.prototype, “Foo”).returns(true); FUT – Function Under Test


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();...