sinon-test icon indicating copy to clipboard operation
sinon-test copied to clipboard

utils.isSinon always fails with sinon@3 as getConfig does not exist anymore

Open FlorentD opened this issue 9 years ago • 2 comments

exports.isSinon = function (obj) {
    return !!obj && typeof obj === "object" &&
        typeof obj.getConfig === "function" &&
        !!obj.sandbox && typeof obj.sandbox === "object" && typeof obj.sandbox.create === "function";
};

returns always false since this PR from sinon #1506

Maybe we should delete this assertion typeof obj.getConfig === "function" or find another property.

FlorentD avatar Aug 07 '17 16:08 FlorentD

Let's just fix this today - must be a very easy fix. Basically, all we need to know is if we are able to create sandboxes. I would simply check for the factory functions that are added in Sinon's 1515 PR - in addition to the old sinon.sandbox.create (which would make it backwards compatible).

I can look into this.

fatso83 avatar Aug 07 '17 17:08 fatso83

Released as sinon-test 2.1

fatso83 avatar Aug 08 '17 10:08 fatso83