Fix error reporting when test is failed from hook

In a browser, when a test was failed from a hook, the test was reported as succesfull.
This was impacting global leak detection