javascriptunit-testingphantomjsyuigrover

YUI test error: window.getYUITestResults()


I have error when I run the YUI tests via PhantomJS using grover:

TypeError: 'undefined' is not a function (evaluating 'window.getYUITestResults()')

I found that this error occurs because I use location.reload() and PhantomJS have problem with this.


Solution

  • So here is the solution:

    if (window['phantom'] || window['_phantom']) return;
    location.reload();
    

    Using this simple solution you can skip as may code as you want, good luck!