How to test non-w590> javascript code with doh?

doh is a dojo testing module. I'm trying to use doh to test javascript code not dojo, but I ran into a problem that doh seems intrusive and obliges me to use dojo.provide () in the checked js file (and the corresponding dojo.require () in the test js file). I want the verified js file to be unmodified and dojo -agnostic. Is it possible?

+4
source share
3 answers

I have found a solution.

  • simple /MyModule.js
  • simple / tests / MyModuleTest.js

In the test file, simply use:

dojo.provide("simple.tests.MyModuleTest"); dojo.require("doh.runner"); dojo.require("simple.MyModule",true); 

since the js file is located by its name without checking the dojo.provide () module

http://api.dojotoolkit.org/jsdoc/1.2/dojo.require

+2
source

I think DOH has a dependency on the Dojo loader (only). Have you tried just defining an object that is usually found in dojo.provide? You can get away from this. Instead of doing

 dojo.provide("mytests.mymodule") 

to try

 mytests.mymodule={}; 
0
source

You need to check out this dojo DOH alternative . This is the dojo Foundation Project developed by SitePen.

0
source

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


All Articles