D.B.U. D.B.U. - 28 days ago 5x
Javascript Question

Rhino + Maven + Qunit Object with import property

I have a strange problem and hope someone can help. I'm running headless JavaScript tests with Rhino and QUnit. So I execute my JS tests with Rhino executing RhinoShell in Qunit test class.

And in one of my JS files I have Object with it's own property import something like:

But I have to escape this or mock it in my tests. So I tried to mock it with my own object like:

MyObj = {
import : function() {

And locally with Rhino I have no problem doing this. But when I try to execute it with
some kind of strict mode is enabled and throw error

: invalid property id import : function()...... and so on.

Please help me to mock this object I tried with
but with no success.


The property name import is inadvertently flagged as a reserved word, so use an alternative:

  • Import
  • $import
  • _import