Doh command line JavaScript function testing outside of Dojo root

I am trying to run DOH from dojo -1.3.2 to test simple Javascript functions from the command line. However, I can't get anything to start, and the network seems to be devoid of DOH command line documentation.

Ideally, I would like to:

Tests: C: \ MyProject \ Tests \

Dojo are: C: \ dojo -1.3.2 \ Util \ DOH

As of now, I put a simple test in. \ doh \ tests

I am trying to run in the directory .. \ doh:

java -jar .. \ shrinksafe \ js.jar runner.js testModule = tests.module

Every time I get:

js: JavaScript exception without executing JavaScript: ReferenceError: the window is not detected by the editor An exception occurred: Error: could not load 'tests.module'; recent attempts 'tests / module.js' 0 tests to run in 0 groups

Is there something I have to do that I forgot? I also tried pointing to the dojo.js file using dojoUrl =, but still the same error.

As far as I can see, my tests do not use a window anywhere. I have three files:

Tests /module.js

dojo.provide("tests.module"); dojo.require("tests.functions.functions"); 

tests / functions / functions.js

 dojo.provide("tests.functions.functions"); dojo.require("tests.demoFunctions"); doh.register("tests.functions.functions", [ function test_alwaysTrue(){ doh.assertTrue(tests.demoFunctions.alwaysTrue()); } ]); 

tests /demoFunctions.js

  dojo.provide("tests.demoFunctions"); tests.demoFunctions.alwaysTrue = function(){ return true; }; 

I also tried restructuring the directory to have .. /dojo-1.3.2/ containing the tests. The execution of the same command as indicated above from the command line is not performed the same way. Dir structure:

 /dojo-1.3.2 /dojo /tests ... /util /shrinksafe ... /doh 
+4
source share
4 answers

Not sure where the β€œwindow” comes from, but I don't think it has ever worked properly with tests outside the Dojo directory. Does it work if you copy the / doh utility as a peer-to-peer directory for your tests?

+1
source

If you want your testFolder to be stored outside the default directory dojo -release-xxx \. Add the following to your command: registerModulePath = tests, .. / MyProject / tests

You may need to edit ../ correctly to find the actual directory structure.

+1
source

There is a patch here: http://bugs.dojotoolkit.org/ticket/10511 , which allows you to run command line tests outside of the dojo root, but this did not seem to have been applied in dojo -1.6.1, anyway.

0
source

At the command prompt, you can run DOH tests, including tests outside of the dojo source tree. Create a configuration file like this, where your code modules relate to the dojo / util / doh location:

 require({ paths: { "org/myorg" : "../../../mycode/org/myorg", "com/mycom" : "../../../x/com/mycom" } }); 

and name it config.js. Open a command window and cd into the directory containing the directories "dijit", "dojo", "dojox" and "util". Run this command:

 java -jar util/shrinksafe/js.jar dojo/dojo.js baseUrl=file:///full/path/to/dojo/dojo load=file://full/path/to/config.js load=doh test=com/mycom/tests 

Full answer here: http://dojotoolkit.org/reference-guide/1.9/util/doh.html

Below is a more detailed explanation: http://www.artificialworlds.net/blog/2012/10/09/running-dojo-doh-unit-tests-on-the-command-line-with-rhino/

0
source

Source: https://habr.com/ru/post/1299024/


All Articles