I believe load() is part of Rhino Shell. I think all that the <script /> task runs when using JavaScript is the interpreter. It would only have the pure Javascript standard language features (and a few bits and pieces to interact with Java and the execution context).
It might be easier to run the shell for each test? Like so: java org.mozilla.javascript.tools.shell.Main [options] script-filename-or-url [script-arguments] https://developer.mozilla.org/en/Rhino_Shell#Invoking_the_Shell Or like John Resig does with env.js: http://ejohn.org/blog/bringing-the-browser-to-the-server/ Or maybe, define your own global load() function inside the <script /> tag? On Sat, Aug 21, 2010 at 5:18 PM, Jacob Beard <[email protected]> wrote: > Hi, > > My Ant script currently generates JavaScript modules, and I also have > JavaScript modules for unit testing the generated JavaScript. What I'd like > to do is use a Rhino script element to load the generated JavaScript and the > unit test modules, and run one on the other. In order to do this, I thought > I would use Rhino's global.load() function, passing in paths as needed, but > it looks like load() is not available in the global object when running in > the Ant script context. Alternatively, it seems it would be possible to use > Rhino (loadfile task) or Java API's to read the contents of the files and > then eval them, but unfortunately the unit test module has dependencies on > other modules, and the module loader relies on the existence of load() when > running under Rhino. I'm wondering, is it possible to gain access to load() > in the Ant script context? > > Thanks, > > Jake > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
