Use karma for tests

* Use Karma test runner
* Fix some tests
* Remove more cruft