Inspired from https://medium.com/@coorasse/catch-javascript-errors-in-your-system-tests-89c2fe6773b1
for #747 (closed)