John Firebaugh john.firebaugh at
Thu Sep 13 16:34:52 BST 2012

On Thu, Sep 13, 2012 at 6:02 AM, Tom MacWright <tom at> wrote:

> +1 for Javascript testing in general, though I don't think that our JS
> code in its current state is well-written for tests - it's too much a
> bundle of interconnected DOM logic to be easily split up into unit tests.

Too true -- something to work towards as we clean it up.

Also, while I'm a big fan of mocha for nodejs tests, I'm skeptical of its
> browser support - it seems to fail entirely in IE, which is kind of the
> point of browser testing for me. Is this just me making a mistake? Jasmine
> has fared better in multiple browsers afaik.

What IE version, and what did you try? Both mocha and chai aim for
cross-browser support. The known exception is chai's "should" syntax, which
can't be supported on IE<10. I've switched my pull request to use the
"expect" syntax, which is more compatible.

To be honest though, I'm of a different opinion about the point of browser
testing. I've never got a lot utility from automated cross-browser testing,
and I think browser testing is useful for other reasons. I haven't found
cross-browser script issues to crop up much in the type of code I typically
get under test, and JS tests don't help with finding rendering problems,
which (in my experience) are the majority of cross-browser issues. So in
practice cross-browser validation tends to be a manual process anyway.
However, browser testing is really useful, principally because a) I do
actually want the DOM under test some of the time and non-browser DOM
implementations inevitably fail sooner or later and b) browsers have by far
the best tooling for debugging test failures.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rails-dev mailing list