You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that starting with version 3.0 of testdouble.js, instanceof checks fail for instances of constructor doubles created via td.constructor():
class Dog { }
var FakeDog = td.constructor(Dog);
var dog = new FakeDog();
console.log(dog instanceof Dog); // true in 2.x, false in 3.x
The same is true for ES5-style constructors, i.e. function Dog() {}. This behaviour is in all 3.x versions up to and including 3.1.1. Unfortunately this is a pretty big breaking change for my code base, preventing me from being able to upgrade.
The text was updated successfully, but these errors were encountered:
This was intentional because of bugs in how Babel handles type extension causing bugs. Additionally, extending actual types results in real constructors of faked dependencies being invoked, which was never intentional and definitely problematic.
You can get the old behacior by setting the extend constructor option to true:
Your lucky day! By sheer coincidence, the work in #268 just happened to fix this constraint and enabled me to delete that option & restore 2.x's instanceof behavior. I wasn't aiming to fix this but it just happened to sort itself up.
It seems that starting with version 3.0 of testdouble.js,
instanceof
checks fail for instances of constructor doubles created viatd.constructor()
:The same is true for ES5-style constructors, i.e.
function Dog() {}
. This behaviour is in all 3.x versions up to and including 3.1.1. Unfortunately this is a pretty big breaking change for my code base, preventing me from being able to upgrade.The text was updated successfully, but these errors were encountered: