Comments (13)
It looks to be a problem w/ marshaling real java objects to java. I am looking into this.
from qunit.
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.
Resolved on my consistent-checks branch. Pull request sent. #59
from qunit.
Fixed by d5581ab
from qunit.
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.
@huntc: Can you provide a testcase? Running the QUnit testsuite with Rhino works fine.
from qunit.
Hey there - I'm sorry, I've got caught up in stuff... I'll try putting something together v. soon.
from qunit.
@huntc: Still there? :-)
from qunit.
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.
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.
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.
My apologies for the confusion. Its been a long day!
from qunit.
Seems to work fine. Will reopen if someone provides their own, failing, runner, instead of just the output.
from qunit.
Related Issues (20)
- qunit: command not found HOT 2
- Great convergence effort/suggestion: Making QUnit proxy to node.js and deno testing APIs in these environments HOT 2
- Add DOM hook to allow links to be added after the Rerun link
- Allow non-escaped HTML to be used as an assertion message HOT 1
- importing .css file using webpack css-loader/style-loader causes: TypeError: Unknown file extension ".css" HOT 2
- Improve assert.async Function to Handle Type Checking
- Qunit v2 has incorrectly configured exports HOT 3
- Drop support for IE9-IE10 HOT 3
- Can we move this repo to a monorepo so we can more accurately test different usage scenarios?
- Drop support for node < 18? HOT 1
- Can we drop builtin AMD support? HOT 5
- Can we start a `next` branch so I can start PRing improvements? HOT 1
- Let simple array data in test.each() serve as automatic labels
- Facilitate "close to" number equal assertion HOT 3
- [Feature Request]: Allow more customization of how errors are handled (especially uncaughtrejection). HOT 1
- Web Test Runner and QUnit reporting problems HOT 9
- qunit cannot parse private functions and properties HOT 2
- Not possible to run multiple modules by passing the `module` parameter multiple times HOT 2
- Unify qunitjs.com and api.qunitjs.com
- [QUESTION] How can I forcefully abort a testcase and advance to next in queue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qunit.