When the test runnner starts - run all tests (don't wait for file changes)

When I run rtd I think it should first run all tests and then wait for file changes (to run again).
I implemented this, but not sure if it's a perfect solution. It works but with caveats. 
One problem I see with it is that it'd open a new browser window at http://localhost:9876/ every time it's run (so if I run rtd a few times the browser tabs start to pile up).
Another possible issue is that I found out I have to wait for the browser to be ready (so I added a sleep) and before that I have to wait for karma to be ready (so I added another sleep). These sleep statements could very easily become incorrect, as everything that depends on timing does. But I haven't found another solution for being able to wait for karma and then wait for the browser. 
Anyway, it's a sketch for a solution, let me know what you think.