title: Nightmare: Error: Timeout of 2000ms exceeded. For async tests and hooks
body: <p>I've started experimenting around with Nightmare and mocha to perform automated tests. I am getting the error below, despite following the instruction in the error itself.</p>
  
  <pre><code>var Nightmare = require('nightmare');
  var expect = require('chai').expect;
  
  var url = 'http://www.google.com/'
  
  describe('Page availability', function() {
    it('Should open homepage', function(done) {
      var nightmare = Nightmare();
  
      nightmare
        .goto(url)
        .wait('body')
        .evaluate(function () {
          return document.querySelector('.gb_P').innerHTML
        })
        .end()
        .then(function(text) {
          expect(text).to.equal('images');
          done();
        })
    });
  });
  </code></pre>
  
  <p>when running the above script with `mocha test.js', this is the output that I get:</p>
  
  <pre><code>Page availability
      1) Should open homepage
  
  
    0 passing (2s)
    1 failing
  
    1) Page availability Should open homepage:
       Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
  </code></pre>
  
  <p><strong>Confession:</strong> I am not (yet) versed with promises, but I don't quite get why Mocha isn't accounting for the <strong>done</strong> callback that I've provided inside then. </p>