Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>1. Assuming the following directory structure (based on the question):</strong></p> <pre class="lang-none prettyprint-override"><code>js-test-projects/ node/ lib/ HelloWorld.js - `HelloWorld` Node module tests/ HelloWorld.js - Tests for `HelloWorld` intern.js - Intern configuration file intern/ </code></pre> <p><strong>2. Your Intern configuration file should contain info on the <code>node</code> package and any suites to run:</strong></p> <pre class="lang-js prettyprint-override"><code>// ... // Configuration options for the module loader loader: { // Packages that should be registered with the loader in each testing environment packages: [ 'node' ] }, // Non-functional test suite(s) to run suites: [ 'node/tests/HelloWorld' ] // ... </code></pre> <p><strong>3. Your test file should load <code>HelloWorld</code> using Intern's version of Dojo, like this:</strong></p> <pre class="lang-js prettyprint-override"><code>define([ 'intern!tdd', 'intern/chai!assert', 'intern/dojo/node!./node/lib/HelloWorld.js' ], function (tdd, assert, HelloWorld) { console.log(HelloWorld); }); </code></pre> <p><strong>Note:</strong> You don't <em>have</em> to use Intern's version of Dojo to load the <code>HelloWorld</code> node module in this AMD test, it is just a convenient way to do so. If you have some other AMD plugin that node-requires a node module, that's perfectly fine.</p> <p><strong>4. Finally, to run the tests in a Node.js environment, use Intern's <code>client.js</code> node runner by issuing the following command from within the <code>intern</code> directory:</strong></p> <pre class="lang-none prettyprint-override"><code>node client.js config=node/tests/intern </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload