GithubHelp home page GithubHelp logo

Running on serverside about qunit HOT 13 CLOSED

qunitjs avatar qunitjs commented on June 8, 2024
Running on serverside

from qunit.

Comments (13)

benjaminplee avatar benjaminplee commented on June 8, 2024

It looks to be a problem w/ marshaling real java objects to java. I am looking into this.

from qunit.

benjaminplee avatar benjaminplee commented on June 8, 2024

Issue is rooted in how QUnit handles the QUnit test which includes a setTimeout in the actual test code. QUnit attempts to build an error message using the error object by calling jsDump. Rhino's reference error includes a reference to the internal Rhino error that was thrown which has a reference to what looks like a byte array. When jsDump is called again on this byte array the error above is thrown.

Not sure yet how to solve without adding Rhino specific code to QUnit.

Obvious solutions is to make the QUnit test only execute if setTimeout is defined, but this doesn't solve the bigger issue of how jsdump traverses errors thrown in rhino.

A better solution might be enhancing the "error" parser in jsdump to output the error's message, line number ets, and have the calling code include the type value of "error" so that jsdump doesn't need to try and determine it internally.

from qunit.

benjaminplee avatar benjaminplee commented on June 8, 2024

Resolved on my consistent-checks branch. Pull request sent. #59

from qunit.

jzaefferer avatar jzaefferer commented on June 8, 2024

Fixed by d5581ab

from qunit.

huntc avatar huntc commented on June 8, 2024

Are we sure that this problem is fixed for setInterval? I'm getting the following message given the latest code on the master branch:

InternalError: Java class "[B" has no public instance field or method named "setInterval". (http://localhost:8080/js/com/jquery/qunit/25e4489/qunit-25e4489.js#1177)

from qunit.

jzaefferer avatar jzaefferer commented on June 8, 2024

@huntc: Can you provide a testcase? Running the QUnit testsuite with Rhino works fine.

from qunit.

huntc avatar huntc commented on June 8, 2024

Hey there - I'm sorry, I've got caught up in stuff... I'll try putting something together v. soon.

from qunit.

jzaefferer avatar jzaefferer commented on June 8, 2024

@huntc: Still there? :-)

from qunit.

clayton avatar clayton commented on June 8, 2024

I am receiving this same error while using QUnit and Sinon to test my Backbone.js application.

My Test

module('BackboneView', {
  setup:function(){
    this.myModel = new Backbone.Model;
    this.bindSpy = sinon.spy(this.myModel, "bind");
    this.myView = new Backbone.View({model:this.myModel});
  },
  teardown:function(){
    this.myModel.bind.restore();
  }
});

test('Binds to a change of the foo attribute', function() {
  ok(this.bindSpy.calledWith("change:foo", this.myView.render));
});

The Implementation

window.myView = Backbone.View.extend({
  initialize: function(){
    _.bindAll(this, 'render');
    this.model.bind("change:foo", this.render);
  },
});

When I run my ant build which uses Rhino I get a stack trace like this:

[qunit] ERROR QUnitTestRunner - Exception encountered whilst executing file: /Users/clayton/example/myView.test.js
[qunit] org.mozilla.javascript.EvaluatorException: Java class "[B" has no public instance field or method named "setInterval". (/js/qunit.js#1027)
[qunit]     at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
[qunit]     at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
[qunit]     at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
[qunit]     at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
[qunit]     at org.mozilla.javascript.NativeJavaArray.get(NativeJavaArray.java:103)
[qunit]     at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1617)
[qunit]     at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1437)
[qunit]     at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1423)
[qunit]     at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3027)
[qunit]     at script(/js/qunit.js:1027)
[qunit]     at script(/js/qunit.js:1008)
[qunit]     at script(/js/qunit.js:1091)
[qunit]     at script(/js/qunit.js:1011)
[qunit]     at script(/js/qunit.js:1091)
[qunit]     at script(/js/qunit.js:1011)
[qunit]     at script(/js/qunit.js:1091)
[qunit]     at script(/js/qunit.js:1011)
[qunit]     at script(/js/qunit.js:111)
[qunit]     at script.process(/js/qunit.js:718)
[qunit]     at script.synchronize(/js/qunit.js:709)
[qunit]     at script(/js/qunit.js:102)
[qunit]     at script(sinon-qunit.js:60)
[qunit]     at script(myView.test.js:XX)
[qunit]     at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[qunit]     at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[qunit]     at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
[qunit]     at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
[qunit]     at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
[qunit]     at org.mozilla.javascript.Context.evaluateReader(Context.java:1135)
[qunit]     at com.eddgrant.qtr.QUnitTestRunner.executeJavaScriptFiles(QUnitTestRunner.java:245)
[qunit]     at com.eddgrant.qtr.QUnitTestRunner.executeTestRecipeFile(QUnitTestRunner.java:142)
[qunit]     at com.eddgrant.qtr.QUnitTestRunner.runTests(QUnitTestRunner.java:69)
[qunit]     at com.eddgrant.qtr.QUnitTestRunnerTask.execute(QUnitTestRunnerTask.java:54)
[qunit]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[qunit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[qunit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[qunit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[qunit]     at java.lang.reflect.Method.invoke(Method.java:597)
[qunit]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[qunit]     at org.apache.tools.ant.Task.perform(Task.java:348)
[qunit]     at org.apache.tools.ant.Target.execute(Target.java:390)
[qunit]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
[qunit]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[qunit]     at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[qunit]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[qunit]     at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[qunit]     at org.apache.tools.ant.Main.runBuild(Main.java:809)
[qunit]     at org.apache.tools.ant.Main.startAnt(Main.java:217)
[qunit]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[qunit]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

But, I am using QUnit Test Runner

I'm wondering if there is a version of QUnit that Qunit Test Runner is bundling that is out of date.

from qunit.

huntc avatar huntc commented on June 8, 2024

Hi Clayton,

I think you have contacted the wrong project. My project is:

http://js-testrunner.codehaus.org/

JS Test Runner does not impose any specific version of QUnit on you.

Kind regards,
Christopher

On 28/10/2011, at 12:35 PM, Clayton Lengel-Zigich wrote:

I am receiving this same error while using QUnit and Sinon to test my Backbone.js application.

My Test

module('BackboneView', {
 setup:function(){
   this.myModel = new Backbone.Model;
   this.bindSpy = sinon.spy(this.myModel, "bind");
   this.myView = new Backbone.View({model:this.myModel});
 },
 teardown:function(){
   this.myModel.bind.restore();
 }
});

test('Binds to a change of the foo attribute', function() {
 ok(this.bindSpy.calledWith("change:foo", this.myView.render));
});

The Implementation

window.myView = Backbone.View.extend({
 initialize: function(){
   _.bindAll(this, 'render');
   this.model.bind("change:foo", this.render);
 },
});

When I run my ant build which uses Rhino I get a stack trace like this:

[qunit] ERROR QUnitTestRunner - Exception encountered whilst executing file: /Users/clayton/example/myView.test.js
[qunit] org.mozilla.javascript.EvaluatorException: Java class "[B" has no public instance field or method named "setInterval". (/js/qunit.js#1027)
[qunit]   at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
[qunit]   at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
[qunit]   at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
[qunit]   at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
[qunit]   at org.mozilla.javascript.NativeJavaArray.get(NativeJavaArray.java:103)
[qunit]   at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1617)
[qunit]   at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1437)
[qunit]   at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1423)
[qunit]   at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3027)
[qunit]   at script(/js/qunit.js:1027)
[qunit]   at script(/js/qunit.js:1008)
[qunit]   at script(/js/qunit.js:1091)
[qunit]   at script(/js/qunit.js:1011)
[qunit]   at script(/js/qunit.js:1091)
[qunit]   at script(/js/qunit.js:1011)
[qunit]   at script(/js/qunit.js:1091)
[qunit]   at script(/js/qunit.js:1011)
[qunit]   at script(/js/qunit.js:111)
[qunit]   at script.process(/js/qunit.js:718)
[qunit]   at script.synchronize(/js/qunit.js:709)
[qunit]   at script(/js/qunit.js:102)
[qunit]   at script(sinon-qunit.js:60)
[qunit]   at script(myView.test.js:XX)
[qunit]   at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
[qunit]   at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[qunit]   at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
[qunit]   at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
[qunit]   at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
[qunit]   at org.mozilla.javascript.Context.evaluateReader(Context.java:1135)
[qunit]   at com.eddgrant.qtr.QUnitTestRunner.executeJavaScriptFiles(QUnitTestRunner.java:245)
[qunit]   at com.eddgrant.qtr.QUnitTestRunner.executeTestRecipeFile(QUnitTestRunner.java:142)
[qunit]   at com.eddgrant.qtr.QUnitTestRunner.runTests(QUnitTestRunner.java:69)
[qunit]   at com.eddgrant.qtr.QUnitTestRunnerTask.execute(QUnitTestRunnerTask.java:54)
[qunit]   at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[qunit]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[qunit]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[qunit]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[qunit]   at java.lang.reflect.Method.invoke(Method.java:597)
[qunit]   at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[qunit]   at org.apache.tools.ant.Task.perform(Task.java:348)
[qunit]   at org.apache.tools.ant.Target.execute(Target.java:390)
[qunit]   at org.apache.tools.ant.Target.performTasks(Target.java:411)
[qunit]   at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[qunit]   at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[qunit]   at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[qunit]   at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[qunit]   at org.apache.tools.ant.Main.runBuild(Main.java:809)
[qunit]   at org.apache.tools.ant.Main.startAnt(Main.java:217)
[qunit]   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[qunit]   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

But, I am using QUnit Test Runner

I'm wondering if there is a version of QUnit that Qunit Test Runner is bundling that is out of date.

Reply to this email directly or view it on GitHub:
#56 (comment)

from qunit.

clayton avatar clayton commented on June 8, 2024

I was just commenting to provide an example of the error that someone had mentioned above as possibly being fixed. It sounded like there was some confusion as to if the issue was actually fixed.

from qunit.

huntc avatar huntc commented on June 8, 2024

My apologies for the confusion. Its been a long day!

from qunit.

jzaefferer avatar jzaefferer commented on June 8, 2024

Seems to work fine. Will reopen if someone provides their own, failing, runner, instead of just the output.

from qunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.