Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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: asmodehn@…
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 :


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 8 years ago by ben hockey

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.

comment:2 Changed 8 years ago by ben hockey

In [26804]:

get doh/tests/scopeTest and doh/tests/selfTest working.
refs #13956, #13957, #12672, #12740, #12678 !strict

comment:3 Changed 8 years ago by ben hockey

Milestone: tbd1.7
Priority: normalhigh

comment:4 Changed 8 years ago by ben hockey

Component: TestFrameworkCore

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 8 years ago by ben hockey

fyi - i've also mentioned on #12451 that this issue will be tracked here so that #12451 can be closed for what it was originally opened for.

comment:6 Changed 8 years ago by Kris Zyp

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 8 years ago by ben hockey

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

     
    77       "./_base/array",
    88       "./ready",
    99       "./_base/declare",
    10        //"./_base/connect", // until we decide if connect is going back into non-browser environments
     10       "./_base/connect", // until we decide if connect is going back into non-browser environments
    1111       "./_base/Deferred",
    1212       "./_base/json",
    1313       "./_base/Color",
  • mouse.js

     
    1 define(["./_base/kernel", "./on", "./has", "./dom"], function(dojo, on, has, dom){
     1define(["./_base/kernel", "./on", "./has", "./dom", "./_base/window"], function(dojo, on, has, dom, win){
    22
    33       /*=====
    44       dojo.mouse = {
     
    2929       };
    3030       ======*/
    3131
    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"));
    3434       var mouseButtons;
    3535       if(has("dom-quirks") || !has("dom-addeventlistener")){
    3636               mouseButtons = {
  • _base/window.js

     
    1717       //      |       n.appendChild(dojo.doc.createElement('div'));
    1818}
    1919=====*/
    20 dojo.doc = window["document"] || null;
     20dojo.doc = this["document"] || null;
    2121
    2222dojo.body = function(){
    2323       // summary:

comment:8 Changed 8 years ago by Adam Peller

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 8 years ago by ben hockey

the patch in the above comment is ready to go. i was just waiting to hear if i should commit it.

comment:10 Changed 8 years ago by haysmark

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 8 years ago by ben hockey

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:12 Changed 8 years ago by Rawld Gill

In [26879]:

fixed dojo/_base/connect to load in non-browser environments with patch from neonstalwart; refs #13957; !strict

comment:13 Changed 8 years ago by Rawld Gill

Owner: set to Rawld Gill
Resolution: fixed
Status: newclosed

In [26880]:

removed improper tests; added documentation; fixes #13957; !strict

comment:14 Changed 8 years ago by Rawld Gill

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 8 years ago by bill

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);
	}
}
Note: See TracTickets for help on using tickets.