I am attempting to use the Intern test framework to automate testing of a simple REST API implemented with node.js and StrongLoop. StrongLoop provides an explorer web page
Intern runs its tests in an AMD environment, so require
is the AMD loader's require
, not Node's, hence your error.
To load Node modules, use the intern/dojo/node!
AMD plugin and include them in your module's dependencies, e.g.:
define([
...,
'intern/dojo/node!http'
], function (..., http) {
// Now http contains the exports of Node's http module
});
This is documented in Intern's User Guide under Testing CommonJS Modules.