Closed eastridge closed 10 years ago
I plan to spend a few hours on this this weekend, and had a few questions.
A little bit of background, the phoenix-build project is utilized by most of our external and internal projects and I'd like to keep things somewhat uniform for the sanity of the team :)
It provides a much more limited subset of expect but works in IE 7. It looks like you guys use some of the more special parts so moving to expect.js probably wouldn't be a good idea.
I'll actually spend this weekend getting chai.expect to work in IE 7, they use a handful of easily polyfilled functions so it shouldn't be too bad.
@GeorgeErickson @kpdecker anyone know the state of chai on IE8? Can't find any updates. On the Thorax side I think we will eventually have to care about IE8.
And incidentally it works on IE8, at least some simple demos do.
@eastridge any luck with using an Object.create
pollyfill? It looks like chai isn't doing anything particularly interesting that couldn't be stubbed with ES5-shim / ES5-sham (and since it's only being used for tests, support doesn't have to be 100%).
I can take a stab at it, but I freely admit I'm a bit lost when trying to figure out how to get Throax tests to run in the browser. Is there a wiki somewhere?
@akre54 If you think it's that simple I'd love for you to take a stab at that.
Re: running the tests, this is non obvious. I've added a README with notes:
Welp, I forgot that Object.defineProperty only works on DOM nodes in IE8... no easy solution around this. Maybe the chai guys could add a fallback for expect(obj).to().be().truthy()
?
@akre54 the Object.create
polyfil only gets you past the first error. The much larger issue is the use of defineProperty
which there doesn't seem to be a good way to work around. I believe that rewriting in expect.js is the only option given then interest that the Chai team has shown in supporting anything below IE9.
Yeah totally. I'm not a huge fan of Object.defineProperty
because it's not always clear that the value is meant to be called as a function. It'd be nice if chai had an alternative interface like the one above, but in the meantime expect.js might be the best bet.
I should have been a bit clearer when I closed this. Master is running IE8 tests now. https://travis-ci.org/walmartlabs/thorax/builds/20200198#L2040
oh sweet. :+1:
Released in v3.0.0-alpha.1
Chai doesn't work with IE8, we need to upgrade to latest chai when it comes out or use another lib. Discussion here:
https://github.com/chaijs/chai/issues/124
Note that for what it's worth the sample thorax apps run on IE8.