1. Assuming the following directory structure (based on the question):
js-test-projects/ node/ lib/ HelloWorld.js - `HelloWorld` Node module tests/ HelloWorld.js - Tests for `HelloWorld` intern.js - Intern configuration file intern/
2. The Intern configuration file should contain information about the node package and any classes that are run:
3. Your test file should load HelloWorld using the Intern version of Dojo, for example:
define([ 'intern!tdd', 'intern/chai!assert', 'intern/dojo/node!./node/lib/HelloWorld.js' ], function (tdd, assert, HelloWorld) { console.log(HelloWorld); });
Note. You do not need to use the Dojo intern version to load the HelloWorld node module in this AMD test, this is just a convenient way to do this. If you have another AMD plugin, which is the node -requires node module, that's fine.
4. Finally, to run the tests in Node.js, use the Intern client.js node by running the following command from the intern directory:
node client.js config=node/tests/intern
source share