How to require modules for testing NodeJS with Intern JS?

左心房为你撑大大i 提交于 2019-12-06 00:21:56

require works the same with any of the Intern interfaces. The tricky part is that the AMD require (which you're using in the code above) is not the same as Node's require (which is what you need to use to load Node modules).

If myfiles.js is a node module, you'll need to use Dojo's node plugin to load it, like:

var myfile = require('intern/dojo/node!../myfile');
Omer Malik

Step 1 do it in define

define([
   'intern!xyzModule',
   'intern/chai!abcModule',
],function(xyz,abc){

}

The above is equilant to

var xyz = require(intern!xyzModule);
var abc = require(intern!abcModule);

but some cases it can not load using require so its best to use above method, happened to me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!