title: How to fix mocha error formatting in async assertion
body: <p>I am trying to set up testing in-browser using <a href="http://git://github.com/mochajs/mocha.git" rel="nofollow">Mocha 2.4.5</a> and <a href="https://github.com/shouldjs/should.js" rel="nofollow">Should.js 8.3.0</a>.</p>
  
  <p>Failing <strong>Should</strong> assertions display a useful test failure reason. <br>However, when that same assertion is made in the context of a jQuery Ajax callback, I get an <em>Uncaught Assertion Error</em> instead.</p>
  
  <p>Take the following example:</p>
  
  <pre><code>mocha.setup('bdd');
  var url = 'http://localhost/api/v2/People';
  describe('ajax', () =&gt; {
      var that1 = this;
      it('Passing async assertion', (done) =&gt; {
          $.ajax({ url: url }).done(data =&gt; {
              should(1).be.eql(1);
              done();
          });
      });
      it('Failing async assertion', (done) =&gt; {
          var that2 = this;
          $.ajax({ url: url }).done(data =&gt; {
              should(0).be.eql(1);
              done();
          });
      });
      it('Failing sync assertion', (done) =&gt; {
          should(0).be.eql(1);
          done();
      });
  });
  mocha.run();
  </code></pre>
  
  <p>'Passing async assertion' passes and looks pretty in the test runner output.</p>
  
  <p>'Failing sync assertion' fails and I get a useful stacktrace</p>
  
  <blockquote>
    <p>Fail sync assertion ‣<br>
    AssertionError: expected 0 to equal 1<br>
    at Assertion.fail (<a href="http://path/to/should.js:220:17" rel="nofollow">http://path/to/should.js:220:17</a>)<br>
    at Assertion.Object.defineProperty.value (<a href="http://path/to/should.js:292:19" rel="nofollow">http://path/to/should.js:292:19</a>)<br>
    at Context. (tests.js:337:26)</p>
  </blockquote>
  
  <p>However, 'Failing async assertion' fails (which is fine), but the stacktrace is usless.</p>
  
  <blockquote>
    <p>Fail async assertion ‣<br>
    Error: Uncaught AssertionError (<a href="http://path/to/should.js:200" rel="nofollow">http://path/to/should.js:200</a>)</p>
  </blockquote>
  
  <p>I've played around with setting the ajax context to <em>that1</em> or <em>that2</em>, but it makes no difference.</p>
  
  <p>Is there some other way to format the test cases so asynchronous assertions work?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I get the same thing using a simple timeout to simulate the asynchronicity</p>
  
  <pre><code>mocha.setup('bdd');
  describe('ajax', () =&gt; {
      var that1 = this;
      it('Failing async assertion', (done) =&gt; {
          setTimeout(() =&gt; {
              should(0).be.eql(1);
              done();
          }, 100);
      }).async = true;
      it('Failing sync assertion', (done) =&gt; {
          should(0).be.eql(1);
          done();
      });
  });
  mocha.run();
  </code></pre>