title: Assert Is Breaking Async Function in Mocha Test
body: <p>I'm building a node module and am trying to do my best to unit test the heck out of it. I've setup mocha and chai to do the test handling. I'm having a problem testing my async methods (methods that return promises).</p>
  
  <p>In the following test I am testing a method on an "Upgrade" object.</p>
  
  <pre><code>  it('Should return a list of versions for the default git repo', function (done) {
      fs.writeFileSync(appSetup.CONFIG_FILENAME, JSON.stringify(appSetup.DEFAULT_CONFIG));
  
      var upgrade = new Upgrade({
        quiet: true
      });
  
      upgrade.getVersions().then(function (versions) {
        assert(versions &amp;&amp; versions.length &gt; 0, 'Should have at least one version.');
        assert.equal(1, 2); // this throws the exception which causes the test case not even exist
        done();
      }, done);
    });
  </code></pre>
  
  <p>The <code>getVersions()</code> call returns a promise as the method is async. When the promise resolves I want to test the value returned in the <code>versions</code> variable.</p>
  
  <p>The <code>assert(versions &amp;&amp; versions.length &gt; 0, 'Should have at least one version.');</code> is the actual test. I added <code>assert.equal(1, 2);</code> because I noticed that when the test should fail the test case wouldn't even show up in the test list.</p>
  
  <p>I'm assuming that the assert call is throwing an exception that Mocha should pickup. However it is getting trapped in the promises <code>then</code> handler function.</p>
  
  <p>What is going on here? Why when the assert is going to fail in that method does it not show the test case in the list (it doesn't show as failed; like it doesn't exist)?</p>