Run Mocha tests from Node - 'describe' is not defined
<p>I'm trying to run Mocha tests after, for example, an event fires from within a Node program. I'm trying to avoid using <code>child_process</code>. After reading <a href="https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically" rel="nofollow">this</a> wiki page, I set up my code as follows:</p>

<pre><code>var Mocha = require("mocha");
var Reporter = require("./reporter");

var mocha = new Mocha({
    ui: "tdd",
    reporter: "spec"
});
mocha.addFile("test.js");

mocha.run();
</code></pre>

<p>Where <code>test.js</code> has a valid mocha test. But when I run this, I keep getting <code>ReferenceError: describe is not defined</code>. Why is this happening? (When I searched this problem on Google most of the solutions were about people running <code>test.js</code> with node rather than mocha.)</p>