Skip to content

Commit

Permalink
Add details on the require interface
Browse files Browse the repository at this point in the history
Added a note about how to properly use the require interface via the `mocha` binary. This resolves [the confusion](#1160) that folks have when using the require script in a file that gets run using the `node` binary, not `mocha`.
  • Loading branch information
mrjoelkemp committed Jun 12, 2014
1 parent ade9572 commit 80af6f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ <h3 id="require-interface">Require</h3>
<p>The <code>require</code> interface allows you to require the <code>describe</code> and friend words
directly using <code>require</code> and call them whatever you want. This interface
is also useful if you want to avoid global variables in your tests.</p>
<p>
<i>Note:</i> this only works if
you execute your file via <code>mocha</code>, instead of using <code>node</code> directly. The reason
that you can't use node directly to run your script is that certain mocha methods are exposed
at runtime and only when using the <code>mocha</code> binary.
</p>

<pre><code>var testCase = require('mocha').describe
var pre = require('mocha').before
Expand Down

0 comments on commit 80af6f6

Please sign in to comment.