opitzconsulting / uitest.js

uitest.js is able to load a webpage into a frame, instrument that page and the javascript in that page (e.g. add additional scripts at the end of the document, ...) and execute actions on that page.
MIT License
67 stars 8 forks source link

Simplify `simpleRequire` #10

Open tbosch opened 11 years ago

tbosch commented 11 years ago

Define a module like this:

 uitest.define('someModule', function(require) {
     var otherModule = require('someOtherModule');
 }

A module can load dependent modules using the given require argument in the callback. Every require function has a cache behind it.

A require function can be created using uitest.requireFactory(parentRequire), optionally specifying a parent require function.

This should simply the code of simpleRequire.js a lot, and the parent relationship should also prevent double instantiation of non run modules when they are used by run modules (those under the run folder), which get instantiated for every test anew.