jfirebaugh/konacha — pull request #66 by jfirebaugh (2012-09-06 20:31:50+00:00)
Title: Isolate each spec file in its own iframe

This permits testing components that would otherwise conflict in their use of
globals (for example, if they required differing versions of jQuery), and
prevents accidental order dependence
(at least among specs in different files), thus realizing one of the original
design goals of Konacha.

It builds on the concept of running the specs in an iframe by giving each
spec file its _own_ iframe. Separate iframes have separate global objects and
global scopes.

Only mocha is explicitly shared between iframes, allowing execution progress
to be reported as before. In order to isolate top-level before/beforeEach
hooks, the specs in each file are wrapped in an anonymous suite.

The iframes are initially hidden, each one making itself visible while its
specs run.

Since the server now isolates specs, the runner no longer needs to do so
itself, and can instead simply visit the root, as suggested back in #21.

The README still needs to be updated, noting the upgrade implications, and
replacing references to #test-context.

As it stands, the ability to use a mocha interface other than BDD no longer
works; I believe we may be able to redefine mocha.ui() so that this feature
continues to work (it needs tests).