I am trying to run tests with http://theintern.io NODEJS client, however I get the following error:
~/WebstormProjects/life-tracker3$ node node_modules/.bin/intern-client config=tests/local.intern reporters=console
Error: **Attempt to require unloaded module superagent**
at contextRequire (/home/bogdanbiv/WebstormProjects/life-tracker3/node_modules/intern/node_modules/dojo/dojo.js:255:12)
at req (/home/bogdanbiv/WebstormProjects/life-tracker3/node_modules/intern/node_modules/dojo/dojo.js:30:10)
at /home/bogdanbiv/WebstormProjects/life-tracker3/tests/api_tests/express.tests.js:5:18
at Function.vm.runInThisContext (/home/bogdanbiv/WebstormProjects/life-tracker3/node_modules/intern/node_modules/istanbul/lib/hook.js:163:16)
at /home/bogdanbiv/WebstormProjects/life-tracker3/node_modules/intern/node_modules/dojo/dojo.js:760:8
at fs.js:268:14
at Object.oncomplete (fs.js:107:15)
Using the same config file local.intern.config, intern-runner opens up the browser and runs all tests gracefully (unit + functional). Of course some tests do fail, but that is to be expected. Full "Intern" configuration is available at http://pastebin.com/c24QPxYE .
The stack trace indicates that you are calling require('superagent')
at /home/bogdanbiv/WebstormProjects/life-tracker3/tests/api_tests/express.tests.js:5:18 without actually specifying the superagent module as a dependency, so it fails to load. The require
function inside Intern tests is the AMD loader's require
function, not the Node.js require
function. See testing non-AMD code in the documentation for more information on how to load non-AMD dependencies.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.