Error: done() invoked with non-Error: {}
<p>I'm trying to set up automatic testing, using Mocha and PhantomJS on Selenium with Node. I'm using <code>selenium-webdriver</code> library since it seems to be a popular one, but <strong>when I run the test and try to extract data from a page, it gives me this error:</strong></p>

<pre><code>  1) Test "before each" hook for "Test":
     Error: done() invoked with non-Error: {}
      at ManagedPromise.invokeCallback_ (node_modules/selenium-webdriver/lib/promise.js:1379:14)
      at TaskQueue.execute_ (node_modules/selenium-webdriver/lib/promise.js:2913:14)
      at TaskQueue.executeNext_ (node_modules/selenium-webdriver/lib/promise.js:2896:21)
      at node_modules/selenium-webdriver/lib/promise.js:2775:27
      at node_modules/selenium-webdriver/lib/promise.js:639:7
</code></pre>

<p>I'm not sure why this problem is happening, and searching didn't help because the solutions I had didn't fit my scenario; I'm on:</p>

<ul>
<li>Mac OS X 10</li>
<li>Node.js v4.4.5</li>
<li>PhantomJS 2.1.1</li>
</ul>

<p>Here's my script:</p>

<pre><code>var selenium = require("selenium-webdriver");
var should = require("should");

var URL = "https://android.com";
var driver;

describe("Test", function() {
    this.timeout(15000);

    beforeEach(function(done) {
        driver = new selenium.Builder()
            .withCapabilities(selenium.Capabilities.phantomjs())
            .build();
        driver.get(URL).then(done);
    });

    /* is this an HTML page? */
    it("Test", function() {
        driver
            .getPageSource()
            .should.eventually
            .match(/(.*)\&lt;\!doctype\ html\&gt;(.*)/i);
    });

    afterEach(function(done) {
        driver.quit().then(done);
    });
});
</code></pre>

<p>I've also tried using some gulp scripts I found and other Node.js libraries but they all return different errors ;~;</p>