#13957 closed defect (fixed)
Doh selfTest problem
Reported by: | asmodehn | Owned by: | Rawld Gill |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Core | Version: | 1.7.0b1 |
Keywords: | doh | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
My system : Linux 2.6.38-11-generic #50-Ubuntu SMP Mon Sep 12 21:17:25 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
Problem description :
- Download 1.7.0b5 from http://download.dojotoolkit.org/release-1.7.0b5/
- Run the following commands:
cd utils/doh sh runner.sh test=doh/tests/selfTest
The Dojo Unit Test Harness, $Rev: 23869 $ Copyright (c) 2011, The Dojo Foundation, All Rights Reserved loading test doh/tests/selfTest
js: "<eval'ed string>#1(Function)#1(eval)", line 131: uncaught JavaScript? runtime exception: TypeError?: Cannot find function connect in object [object Object].
at <eval'ed string>#1(Function)#1(eval):131 at <eval'ed string>#1(Function)#1(eval):28 at <eval'ed string>#1(Function)#1(eval):163
However, when running in the browser with file:///path_to_dojo-release-1.7.0b5-src/util/doh/runner.html?test=doh/tests/selfTest :
4 tests to run in 4 groups ------------------------------------------------------------ GROUP "doh/asserts/pass" has 1 test to run PASSED test: 0 ms ------------------------------------------------------------ GROUP "doh/asserts/fail" has 1 test to run PASSED test: 1 ms ------------------------------------------------------------ GROUP "myGroup2-1" has 1 test to run PASSED test: 0 ms ------------------------------------------------------------ GROUP "myGroup2-2" has 1 test to run PASSED test: 0 ms WOOHOO!! ------------------------------------------------------------ | TEST SUMMARY: ------------------------------------------------------------
4 tests in 4 groups 0 errors 0 failures
Change History (15)
comment:1 Changed 10 years ago by
comment:3 Changed 10 years ago by
Milestone: | tbd → 1.7 |
---|---|
Priority: | normal → high |
comment:4 Changed 10 years ago by
Component: | TestFramework → Core |
---|
for reference, dojo/_base/connect is not included outside of the browser because it has an indirect dependency on dojo/_base/window that has a reference to window["document"]
. of course, in non-browser environments, window
does not exist. a possible fix might be to change the reference to this["document"]
.
changing the component to "core" for this ticket since that's closer to the cause of the issue.
comment:5 Changed 10 years ago by
comment:6 Changed 10 years ago by
Changing the reference to this.document is fine with me. Can you try it out, I've never run the rhino tests before?
comment:7 Changed 10 years ago by
this is what it takes to get this particular test to pass. there's likely to be other references to document and window in dojo core that would break but this is enough to get just this one test working.
shall i commit it?
-
main.js
7 7 "./_base/array", 8 8 "./ready", 9 9 "./_base/declare", 10 //"./_base/connect", // until we decide if connect is going back into non-browser environments10 "./_base/connect", // until we decide if connect is going back into non-browser environments 11 11 "./_base/Deferred", 12 12 "./_base/json", 13 13 "./_base/Color", -
mouse.js
1 define(["./_base/kernel", "./on", "./has", "./dom" ], function(dojo, on, has, dom){1 define(["./_base/kernel", "./on", "./has", "./dom", "./_base/window"], function(dojo, on, has, dom, win){ 2 2 3 3 /*===== 4 4 dojo.mouse = { … … 29 29 }; 30 30 ======*/ 31 31 32 has.add("dom-quirks", document.compatMode == "BackCompat");33 has.add("events-mouseenter", "onmouseenter" in document.createElement("div"));32 has.add("dom-quirks", win.doc && win.doc.compatMode == "BackCompat"); 33 has.add("events-mouseenter", win.doc && "onmouseenter" in win.doc.createElement("div")); 34 34 var mouseButtons; 35 35 if(has("dom-quirks") || !has("dom-addeventlistener")){ 36 36 mouseButtons = { -
_base/window.js
17 17 // | n.appendChild(dojo.doc.createElement('div')); 18 18 } 19 19 =====*/ 20 dojo.doc = window["document"] || null;20 dojo.doc = this["document"] || null; 21 21 22 22 dojo.body = function(){ 23 23 // summary:
comment:8 Changed 10 years ago by
we're likely going to need an rc2 in the coming days for a loader fix. is this patch ready, or should we move off to another milestone?
comment:9 Changed 10 years ago by
the patch in the above comment is ready to go. i was just waiting to hear if i should commit it.
comment:10 Changed 10 years ago by
You should probably remove the comment about connect being removed, seeing as we just added it back.
Here are the results I get. It looks like there are still some unrelated issues...
C:\Users\IBM_ADMIN\IBM\dojo\util\doh>java -jar ../shrinksafe/js.jar ../../dojo/d ojo.js baseUrl=../../dojo load=doh test=doh/tests/selfTest ------------------------------------------------------------ The Dojo Unit Test Harness, $Rev: 23869 $ Copyright (c) 2011, The Dojo Foundation, All Rights Reserved loading test doh/tests/selfTest ------------------------------------------------------------ ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-3)functionnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-7)string(dohSelfTestLog7();)numberfunctionund efined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-11)objectnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-15)objectnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-19)objectnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-23)objectnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-27)objectnumberfunctionundefined ERROR: illegal arguments provided to dojo.register arguments: string(myGroup2-31)objectnumberfunctionundefined 36 tests to run in 28 groups ------------------------------------------------------------ GROUP "myGroup2-29" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-10" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-12" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-1" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-13" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-2" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-14" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-4" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-16" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-5" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-6" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-17" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-18" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-8" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-9" has 2 tests to run ------------------------------------------------------------ GROUP "myGroup2-30" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-32" has 1 test to run ------------------------------------------------------------ GROUP "doh/selftest/lastTest" has 1 test to run ------------------------------------------------------------ GROUP "doh/asserts/fail" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-20" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-21" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-22" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-24" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-25" has 1 test to run ------------------------------------------------------------ GROUP "myGroup2-26" has 1 test to run ------------------------------------------------------------ GROUP "doh/async" has 3 tests to run running test the SHOULD FAIL Error: hrm... ERROR IN: (function (t) {console.log("running test the SHOULD FAIL");var d = new doh.Deferred();setTimeout(function () {d.errback(new Error("hrm..."));}, 50);return d;}) running test the SHOULD FAIL Error: test timeout in timeoutFailure--SHOULD FAIL ERROR IN: (function (t) {console.log("running test the SHOULD FAIL");var d = new doh.Deferred();setTimeout(function () {d.callback(true);}, 100);return d ;}) debug: Error running setTimeout thread:Error: already called!
comment:11 Changed 10 years ago by
good point about removing the comment - i've made that change locally.
as for the test output, the 2 errors (at the end of the output) are expected (as mentioned in the output) and it looks like the error messages at the top of the output are to be expected as well but that's the best i can deduce from the code without knowing for sure. since the test is the doh self test it makes sense that it might also test how improper usage is handled.
comment:13 Changed 10 years ago by
Owner: | set to Rawld Gill |
---|---|
Resolution: | → fixed |
Status: | new → closed |
In [26880]:
comment:14 Changed 10 years ago by
The tests removed in [26880] were all testing a teardown function without a setup function. While there may be some odd case where this is useful, at best it would be rare. Further complicating the already-complicated argument decoding of doh.register to accommodate this rare case seems like a bad idea. Therefore, removed the tests and added docs to say that signature is not allowed.
comment:15 Changed 9 years ago by
Rawld, are you implying that code like below in dijit/tests/Tooltip-placement.html will no longer work?
{ name: "test1_tall_skinny", timeout: 4000, runTest: function(){ var d = new doh.Deferred(); ... return d; }, tearDown: function(){ dojo.disconnect(handler); } }
i've added a comment to #12451 relating to this issue - hopefully that will help towards getting this resolved. currently, dojo.connect is not being included in non-browser environments and that is the cause of this issue. that is also why it works in the browser but not from the command line.