logicalparadox/chai — Issue #32: IE problems
Author: domenic
Created: 2012-02-28 01:58:02+00:00
State: open

IE10 refuses to run while the document is in quirks mode. So first, that needs to be fixed, by adding `` to index.html.

After that, here are the problems I am discovering on IE10 developer preview (10.0.8102.0). There are lots of them, somewhat surprisingly given its excellence at test-262.

### The name property

Chai uses the `name` property in its assertion messages, which functions do not have in IE. Thus you get lots of failures like

> AssertionError: expected 'expected 3 to be an instance of Foo' to equal 'expected 3 to be an instance of undefined'

### Other problems with `inspect` and the messages it produces

Various other tricks that `inspect` is doing fail:

> AssertionError: expected 'expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]' to equal 'expected \'asd\' to have a property \'constructor\' of [Function], but got [Function]'

### Coercion of numbers to `Number`s.

This one's wierd.

When using `should`, numbers get `inspect`ed as `"{}"`. E.g. typing this in the console:

```javascript
(0).should.not.be.ok
```

gives the assertion error `expected {} to be falsy`. This in turn is because `(0).should.inspect === "{}"`, which is because `typeof (0).should.obj === "object".

Here's the problem: inside the getter for `Object.prototype.should`, `typeof this === "object"`. This seems like an IE bug or perhaps a place the spec isn't clear enough in. Fascinating... and evil.