javascript - How to require modules for testing NodeJS with Intern JS? -
i'm getting error attempt require unloaded module xxxxxx
following intern.js test (myfile.js below require('xxxxxx')
) testing nodejs.
define(function(require) { var bdd = require('intern!bdd'); var myfile = require('../myfile.js'); bdd.describe('the thing being tested', function() { bdd.it('do test', function() { ...
the directory structure
intern.js myfile.js test |-- test.js
how require file? there's no examples on how bdd test interface. there examples of doing other style in how load node.js http module within intern.js test? doesn't use bdd.
does have properties need set in intern.js file?
require
works same of intern interfaces. tricky part amd require (which you're using in code above) not same node's require (which need use load node modules).
if myfiles.js
node module, you'll need use dojo's node
plugin load it, like:
var myfile = require('intern/dojo/node!../myfile');
Comments
Post a Comment