How to Detect JavaScript Errors in Automated Tests

How to Detect JavaScript Errors in Automated Tests