Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test suite fails on IE9 #66

Closed
rosenfeld opened this issue May 22, 2012 · 7 comments
Closed

Test suite fails on IE9 #66

rosenfeld opened this issue May 22, 2012 · 7 comments

Comments

@rosenfeld
Copy link

Official documentation points to an online suite that doesn't seem to exist:

http://chaijs.com/guide/installation/

Points to:

http://chaijs.com/support/tests/

I found this working link:

http://chaijs.com/api/test/

And it fails on IE9.

@logicalparadox
Copy link
Member

@rosenfeld - I am assuming you are referring to the should interface not working? Also, will fix the link issue. Thanks!

@domenic - Can you confirm what is and is not working? Also, should be do a browser expectations table on the top of the tests perhaps?

@rosenfeld
Copy link
Author

Hi @logicalparadox, sorry, I can't remember, I had just followed the link in my wife's notebook but I have already turned it off long ago, but it should be easy to replicate this if you have IE9 ;)

@domenic
Copy link
Contributor

domenic commented May 24, 2012

OK, so, we have some new problems, sadly. In addition to should being borked due to my favorite IE bugs ever (1, 2), the recent expansion of __proto__ usage in the 1.0 release has caused a number of failing tests in even the expect interface.

Disregarding should, the following tests fail:

  • Assertion.includeStack is true
  • Assertion.includeStack is false
  • expect instanceof
  • expect keys
  • assert include

These generally occur because of use of include/contains, while a/an could also be problematic.

The only solution I could see would be to, instead of using __proto__ directly, copy over all the asserter properties (and flags), much like I do in Chai as Promised, but much simpler.

@domenic
Copy link
Contributor

domenic commented May 24, 2012

Oh dammit functions in IE10 have a non-configurable arguments property that you can't overwrite in this way. Wait, does this even work in other browsers? Hmm.

@domenic
Copy link
Contributor

domenic commented May 24, 2012

OK I can get the above tests passing, excluding (for some reason) "Assertion.includeStack is false," with the following diff:

var asserterNames = Object.getOwnPropertyNames(Assertion.prototype);
asserterNames.forEach(function (asserterName) {
  if (asserterName === "arguments" || asserterName === "length") { return; }
  var propertyDescriptor = Object.getOwnPropertyDescriptor(Assertion.prototype, asserterName);
  Object.defineProperty(assert, asserterName, propertyDescriptor);
});
assert.__flags = this.__flags; // i guess i'd update to use `getAllFlags` nowadays.
//assert.__proto__ = this;

The arguments and length exemptions imply that

expect([1, 2, 3]).to.have.a.length(5)

would break. But I just tested and that doesn't work in other browsers even with __proto__, so I guess the above would be purely a fix.

@rosenfeld
Copy link
Author

It seems Microsoft won't allow non-registered users to see their bugs... :( I wonder what is the reason for that policy...

domenic added a commit that referenced this issue May 27, 2012
@logicalparadox
Copy link
Member

@domenic 's changes have been merged into release 1.0.2 so we are back to the expected IE support.

koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
…ijs#66)

* Adding compare function to be used in expected object template

* Adding compare function example to README.md
koddsson pushed a commit to koddsson/chai that referenced this issue May 20, 2024
…ijs#66)

* Adding compare function to be used in expected object template

* Adding compare function example to README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants