Massive improvements to test structure.

 - An actual api for test module.
 - Work transparently on node and browser.
 - Add (conditional) karma scenario.
 - Use karma scenario for coverage.