#2506 JS: Runner does not load transitive dependencies

SlimerDude Sat 6 Feb 2016

If I try to run JS tests for one of my libraries, I get the following Err:

C:\> fant -js afIocEnv

sys::Err: Pod eval failed: afIoc
  compilerJs::Runner.evalPodScript (Runner.fan:79)
  fan.sys.List.each (List.java:588)
  compilerJs::Runner.evalPodScript (Runner.fan:73)
  compilerJs::TestRunner.evalPod (TestRunner.fan:79)
  compilerJs::TestRunner.main (TestRunner.fan:55)
  ...
Cause:
  sys::Err: javax.script.ScriptException: 
    sun.org.mozilla.javascript.internal.EcmaError: 
      TypeError: Cannot read property "NotFoundErr" from undefined 
        (<Unknown source>#3956) in <Unknown source> at line number 3956
    com.sun.script.javascript.RhinoScriptEngine.eval (RhinoScriptEngine.java:156)
    com.sun.script.javascript.RhinoScriptEngine.eval (RhinoScriptEngine.java:170)
    javax.script.AbstractScriptEngine.eval (AbstractScriptEngine.java:247)
    compilerJs::Runner.evalPodScript (Runner.fan:78)
    fan.sys.List.each (List.java:588)
    compilerJs::Runner.evalPodScript (Runner.fan:73)
    compilerJs::TestRunner.evalPod (TestRunner.fan:79)
    compilerJs::TestRunner.main (TestRunner.fan:55)
    ...

Which, as it turns out, is because compilerJs::Runner doesn't load scripts for transitive dependencies.

In this particular case the dependency tree is afIocEnv -> afIoc -> afBeanUtils. As in afIocEnv has no direct dependency on afBeanUtils but afIoc does.

When Runner loads a script, it should really try to load transitive dependencies first.

In the mean time, the obvious workaround is to make afBeanUtils a direct dependency of afIocEnv.

andy Mon 8 Feb 2016

Ticket promoted to #2506 and assigned to andy

andy Thu 8 Jun

@Steve - this may still be true - but I just made our NodeJS runner the default for fant - so may work differently now.

Could you verify this is still an issue against tip?

SlimerDude Mon 12 Jun

Running on JDK 1.6 still gives Rhino errors:

C:\Projects\.f4\ScratchPad>fant -js afIocEnv
sys::Err: Pod eval failed: afIoc
  compilerJs::Runner.evalPodScript (Runner.fan:79)
  ...
Cause:
  sys::Err: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing name after . operator (<Unknown source>#8947) in <Unknown source> at line number 8947
    com.sun.script.javascript.RhinoScriptEngine.eval (RhinoScriptEngine.java:156)
    com.sun.script.javascript.RhinoScriptEngine.eval (RhinoScriptEngine.java:170)
    javax.script.AbstractScriptEngine.eval (AbstractScriptEngine.java:247)
    compilerJs::Runner.evalPodScript (Runner.fan:78)
    ...

and on JDK 1.8 get (a more detailed) Nashorn error:

C:\Projects\.f4\ScratchPad>fant -js afIocEnv
sys::Err: Pod eval failed: afIoc
  compilerJs::Runner.evalPodScript (Runner.fan:79)
  ...
Cause:
  sys::Err: javax.script.ScriptException: TypeError: Cannot read property "NotFoundErr" from undefined in <eval>
    jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException (NashornScriptEngine.java:467)
    jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl (NashornScriptEngine.java:451)
    jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl (NashornScriptEngine.java:403)
    jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl (NashornScriptEngine.java:399)
    jdk.nashorn.api.scripting.NashornScriptEngine.eval (NashornScriptEngine.java:155)
    javax.script.AbstractScriptEngine.eval (AbstractScriptEngine.java:264)
    compilerJs::Runner.evalPodScript (Runner.fan:78)
    ...

Note that both errors still point to not loading transitive dependencies.

andy Mon 12 Jun

Make sure you do a buildall - tip no longer uses Rhino/Nashhorn via Java - will always look for NodeJS (and so also need to install NodeJS :)

SlimerDude Mon 12 Jun

also need to install NodeJS

Urgh... :(

This'll have to wait until I need it then...

Login or Signup to reply.