openannotation/annotator — pull request #453 by nickstenning (2014-10-15 17:31:55+00:00)
Title: Browser tests via Karma

This PR replaces our custom test runner with one based on Karma, with a view to using [karma-sauce-launcher](https://github.com/karma-runner/karma-sauce-launcher) in due course to run cross-browser tests on Travis.

In order to make this possible, I've simplified some of the assumptions we make about how to browserify Annotator. The largest change is that plugins no longer `require('annotator')` to get a magic shim, but instead `require('annotator-plugintools')`, a standalone package containing the shim. This means that we no longer need a browserify plugin to build 3rd-party plugins that can themselves be browserified. See `contrib/plugintools` for more details.

Tests pass locally using browsers manually connected to Karma, as well as with the default runner, Phantom.

Travis passes using Phantom, and we can later add support for running browser tests on Sauce.

Lastly, `tools/serve` is simplified by using [browserify-middleware](https://github.com/ForbesLindesay/browserify-middleware) and not serving the tests.

NB: I've broken `tools/build` by upgrading browserify. Happy to fix this if we want to block this PR on that.