okfn/annotator — pull request #279 by nickstenning (2013-11-03 13:01:37+00:00)
Title: Browserify branch proposed modifications to testing

A bunch of rather harmless changes for integration into the `browserify` branch, as well as a major rejigging of how test dependencies are loaded. @tilgovi this is, I think, a nicer way of managing the tests, but I'm aware that I might have broken some of your source map stuff. In particular, backtraces from test failures don't appear to have correctly-aligned line numbers.

The most relevant commit message is:

> Rather than having each test suite rely on global scope, this change
causes each test suite to become a self-contained module, which is
forced to explicitly require its own dependencies.
>
> This is ugly in places, but only because it exposes underlying couplings
in the test suite. This is a good thing, because it will hopefully
encourage us to remove these in future.
>
> One major open question is how dependencies should work for plugins. At
the moment, plugins inject themselves into the Annotator namespace,
which requires that each plugin file require()s the core Annotator
module. This seems wrong: we should probably be working towards plugins
which can be entirely standalone, and which have the relevant Annotator
instance provided to them as a constructor argument (i.e. dependency
injected).