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
var validInstanceOfTarget = constructor === Object(constructor) && (
typeof constructor === 'function' ||
(typeof Symbol !== 'undefined' &&
typeof Symbol.hasInstance !== 'undefined' &&
Symbol.hasInstance in constructor)
);
This validation fails on IE11, IE10, and Safari 7 when the constructor is HTMLInputElement.
I'm guessing it's broken for other HTMLElement constructors, and other (old) environments as well.
@AviVahl Thanks for the report! I agree that this is a regression in Chai v4 for at least one browser that we actively support: IE11. It's unfortunate that the spec isn't being followed in this case, but I think Chai needs to honor it.
The PR that added this regression is #899, in response to #893. I suspect it's possible to fix this regression while still resolving #893.
Starting with chai v4, instanceOf now validates the target as a constructor function.
The assertion resides in: https://github.com/chaijs/chai/blob/master/lib/chai/core/assertions.js#L1604
This validation fails on IE11, IE10, and Safari 7 when the constructor is HTMLInputElement.
I'm guessing it's broken for other HTMLElement constructors, and other (old) environments as well.
Sample code which shows the failure:
https://github.com/wix/wix-react-components/blob/master/test/components/number-input.spec.tsx#L17
Failure log:
https://travis-ci.org/wix/wix-react-components/builds/248446200
Notes:
typeof HTMLInputElement === "object"
on IE11.<number-input-dom-instance> instanceof HTMLInputElement === true
on IE11Same assertion worked with chai 3, as there was no validation.
The text was updated successfully, but these errors were encountered: