Try fixing JS unit tests.

They're still broken sometimes. It must be our tools.
Add chai-as-promised and fix JS unit test races