How to configure mocha when external dependencies are involved

时间:2015-06-20 09:38:53

标签: javascript node.js mocha

My folder structure is

-assets

    - apps
        - login
            -adminLogin.js
    - data
        - trackerDb.js
-specs

    - apps
        -login
            -adminLogin_spec.js

specRunner.js

I have specRunner.js file which i have added as test initialization in package.json in root like

"test": "node assets/spec_Runner.js" This specrunner includes the all the test that needs to be run.

The first line of adminLogin.js is define("trackerDb"),function(tracker){ //complete code} Now when i am writing test case for this source file and running it, throws error like "cannot find trackerDb.js"

So my question is do i need to pass every js file with relative path .. if so then what about external module like jquery, underscore etc..

Do we have any other way by which we can directly configured mocha so that it can find every path.

0 个答案:

没有答案