Fixed running in node.js

Hi!
I was trying to run the junit reporter module directly in node.js (run in a "grunt" shell on Jenkins), but I've found that nodeJs crashes during the evaluation of "window && window.location".
I've rewritten the test in order to run without exceptions.

In addition, I've found that for some reason, the QUnit.log() call could be called _before_ any QUnit.begin() or QUnit.moduleStart().
So basically the fix allow to log error on console if something went wrong before any test startup.

Could you please review my change?

Thank you,
 Luciano