Unit testing for JavaScript code running inside PhantomJS