Adding support for handling javascript errors.

This solution is a bit hackish. But allows us to forward console output
and errors from javascript to test runner.

There can be multiple errors, and each of them will get reported.

Also specs will be marked as failed which gives correct error status for CI