title: timeout exceeded error in Async Mocha tests
body: <p>I am using Mocha and should for testing simple database queries, I am trying to run Async tests for simple Moongose schema functions, but I am getting timeout exceeded error everytime.</p>
  
  <pre><code>  Error: timeout of 15000ms exceeded
    at null.&lt;anonymous&gt; (/usr/local/lib/node_modules/mocha/lib/runnable.js:165:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
  </code></pre>
  
  <p>I have even used <em>this.timeout(15000)</em> and also tried <em>--timeout 15000</em> in the mocha command but of no success, what ever timeout time I give I am getting this error. Only synchronous tests are passing. Below are my tests and function which I want to test.</p>
  
  <p><strong>My Mocha Test:-</strong></p>
  
  <pre><code>   describe('#getFacility()', function () {
      this.timeout(15000);
      it('should get facility successfully', function (done) {
          db.getFacilites(Data.testFacility, function (err, facilities) {
              if (err) throw err;
              facilities.Name.should.equal(Data.testFacility.body.Name);
              done();
          })
      });
  });
  </code></pre>
  
  <p><strong>My Data:-</strong></p>
  
  <pre><code>testFacility : {
      params:  { clientId:"51c85c3267b6fc1553000001" }
  },
  </code></pre>
  
  <p><strong>My Get Function</strong></p>
  
  <pre><code>getFacilites: function (req, res) {
      Facility.find({Client: req.params.clientId}, function (err, facilities) {
          if(err) {
              res.send(500,err);
          } else if (!facilities) {
              res.send(404, "facilities not found");
  
          } else if (req.query.format &amp;&amp; req.query.format === 'select') {
              var result = facilities.map (function (f) {
                  return { value: f._id.toString(), text: f.Name }
              });
              res.json(result);
  
          } else {
              console.log("Cannot Retrieve Facilities");
          }
      });
  }
  </code></pre>
  
  <p>I even created a new separate function for query too, but it is still not working. any Ideas that function looks like this.</p>
  
  <pre><code>describe('#getFacility() direct from DB', function () {
      it('should get facility successfully from db', function (done) {
          Client_data.Facility.find({Client: Data.testFacility.params.clientId}, function(err, facilities) {
              if (err) throw (err);
              if (facilities) {
                  facilities.forEach(function (f) {
                      console.log(f);
                  });
                  done();
              }
          });
      });
  });
  </code></pre>
  
  <p>If I try to call done() callback after the query, test passes, but that's also not look good
   to me.</p>
  
  <pre><code>describe('#addFacility()', function () {
      it('should add facility successfully', function (done) {
          API_Calls.addFacility(Data.testFacility, function (doc) {
              doc.Name.should.equal(Data.testFacility.body.Name);
          });
          done();
      });
  });
  </code></pre>