Anyone have any suggestions on how to get DOH to work with debugAtAllCosts
work, or is it just a bad idea?
Here is what I am seeing as I work on it with Firefox 3.6, FireBug, Dojo
1.5.0-src…
If I just add debugAtAllCosts to runner.html I get the following (as
described in http://bugs.dojotoolkit.org/ticket/10443) in the console.
TypeError: dojo.hostenv is undefined
uncaught exception: Could not load cross-domain resources: doh.runner
If I change the dojo.require(“runner.js”) section to use a <script> tag like
the following
<script type='text/javascript'
src='http://localhost:8080/dev/js/libs/dojo/dojo-release-1.5.0-src/util/doh/runner.js'></script>
then I get:
TypeError: availableFlatLocales is undefined
Error: Could not load 'dojo.number'; last tried './number.js'
Error: Could not load 'dojox.charting.plot2d.Pie'; last tried
'../dojox/charting/plot2d/Pie.js'
Error: Could not load 'dojox.charting.Chart2D'; last tried
'../dojox/charting/Chart2D.js'
uncaught exception: Could not load cross-domain resources:
doh._browserRunner dojox.charting.Chart2D dojox.charting.plot2d.Pie
dojo.number
If I then switch to 1.6.0b1-src, I get past all the errors above – but I
have no tests shown in the browser.
Any thoughts?
Thanks,
dave
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOH-with-proper-stack-trace-debugAtAllCosts-tp2365333p2365333.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
<Sorry if this is a duplicate for some. I posted on 1/27 through nabble at http://dojotoolkit.org/community, but I think I wasn't subscribed to mailing list yet so it didn't make it to the mailing list (I don't see it in the archive).> I'm interested in having my DOH errors show the actual file where the error is. By default everything is shown inside in bootstrap.js, so I have been looking at adding debugAtAllCosts to runner.html. But then I run into issues (described below). Anyone have any suggestions or experience on how to get DOH to work with debugAtAllCosts? Or is it a bad idea for some reason I am missing? The inability to see the line numbers and inability to debug is kind of killing my ability to do "test first development". Here is what I am seeing as I work on it with Firefox 3.6, FireBug, dojo-1.5.0-src… |
If I just add debugAtAllCosts to runner.html I get the following (as described in http://bugs.dojotoolkit.org/ticket/10443) in the console.
TypeError: dojo.hostenv is undefined uncaught exception: Could not load cross-domain resources: doh.runner |
If I change the dojo.require(“runner.js”) section to use an explicit <script> tag for doh.runner like the following
|
<script type='text/javascript' src='http://localhost:8080/dev/js/libs/dojo/dojo-release-1.5.0-src/util/doh/runner.js'></script> then I getTypeError: availableFlatLocales is undefined
Error: Could not load 'dojo.number'; last tried './number.js' Error: Could not load 'dojox.charting.plot2d.Pie'; last tried '../dojox/charting/plot2d/Pie.js' Error: Could not load 'dojox.charting.Chart2D'; last tried '../dojox/charting/Chart2D.js' uncaught exception: Could not load cross-domain resources: doh._browserRunner dojox.charting.Chart2D dojox.charting.plot2d.Pie dojo.number If I then switch to 1.6.0b1-src, I get past all the errors above – but I have no tests shown in the browser. |
I have tried putting a addOnLoad around the test runner code also, with the same results (no tests). I suspect I am not properly refactoring runner.html and possibly dealing with an assumption in doh.runner about load approach (at least in 1.5.0).
Any thoughts or lessons learned someone could share? Thanks, dave |
Bill Keese-2 wrote:
>
> Hmm, you could try using the AMD loader (see
> http://docs.dojocampus.org/releasenotes/1.6#id10), although it won't be
> ready for prime-time until the 1.7 release, so it's somewhat DIY now.
>
Thanks for the tip Bill. The AMD stuff looks useful, I like that it will be
consistent with CommonJS and RequireJS's approach. A common module approach
across the main toolkits would be great. I'm hesitant to mess with it tills
its more baked though. The work they are doing does seem to have fixed it
for 1.6b2 (vs. 1.6b1) though - see my next post.
d
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOH-with-proper-stack-trace-debugAtAllCosts-tp2365333p2435666.html
I had to change runner.js from to use requireIf rather than platformRequire.
platformRequire breaks under XD as previous described in
http://mail.dojotoolkit.org/pipermail/dojo-interest/2009-August/037840.html.
I’ve created a ticket and attached a patch that fixes this for 1.5 -
http://bugs.dojotoolkit.org/ticket/12260.
I also modified runner.html to allow adding debugAtAllCosts=true to the URL
parameters to turn debugAtAllCosts on. Ticket and patch are at
http://bugs.dojotoolkit.org/ticket/12261.
Unfortunately, in 1.5.0 I am unable to use debugAtAllCosts with the dojo
tests themselves due to a 2nd problem with XD and requireLocalization.
Several modules use a setUp pattern like the following:
var setUp = function(locale){
return function(){
dojo.requireLocalization("tests","salutations",locale);
}
}
This will fail when XD loaded because the XD loader uses a regexp to pull
and eval just the dojo.requireLocalization line. The eval fails since its
missing the setUp closure that defines locale. The modules I have found
using this pattern are tests.i18n, tests.date.locale, test.number.
I don’t understand the thinking behind XD behavior enough to know how to
work around this and it seems fixed in 1.6b2 (the offending tests have been
refactored). So I just created the ticket
http://bugs.dojotoolkit.org/ticket/12262 and am leaving it there for now.
dave
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOH-with-proper-stack-trace-debugAtAllCosts-tp2365333p2435755.html
Issue and patch (for 1.5 and 1.6) are at
http://bugs.dojotoolkit.org/ticket/12263.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOH-with-proper-stack-trace-debugAtAllCosts-tp2365333p2439030.html
reesd wrote:
>
>
> Bill Keese-2 wrote:
>>
>> Hmm, you could try using the AMD loader (see
>> http://docs.dojocampus.org/releasenotes/1.6#id10), although it won't be
>> ready for prime-time until the 1.7 release, so it's somewhat DIY now.
>>
> Thanks for the tip Bill. The AMD stuff looks useful, I like that it will
> be consistent with CommonJS and RequireJS's approach. A common module
> approach across the main toolkits would be great. I'm hesitant to mess
> with it tills its more baked though. The work they are doing does seem to
> have fixed it for 1.6b2 (vs. 1.6b1) though - see my next post.
>
Actually, its not really "fixed" in 1.6b2. What is really happening is that
1.6b2 ignores the debugAtAllCosts (or at least the XD portion of it) since
1.6b2 doesn't support async loading. So I don't see the errors, but I also
don't see filenames. The release notes say its possible to try and do it
with RequireJS - but I don't think I want to mess with "unofficial" loaders
for now. I think I'll wait till 1.6 has built-in async to try it out.
d
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOH-with-proper-stack-trace-debugAtAllCosts-tp2365333p2439195.html
dependencies = {
copyTests: true,
optimize: '',
loader: 'xdomain',
layers: [
// ...your layers...
]
// etc.
}
There's one more step - ensure your test_*.html files load the dojo.xd.js:
find $releaseDir -type f -print0 | xargs -0 grep -l 'dojo.js' | xargs
sed -i '' -e 's/dojo.js/dojo.xd.js/g'
..better still use .php or similar for your test pages so your path to
dojo.js can be easily parameterized.
This does 2 things:
1) It lets you test your build profile, and test your code's
observance of best practices wrt. async loading (i.e. use of
dojo.ready).
2) It lets you run your tests using the xdomain loader - which means
real script tags and proper stack traces with real line numbers.
hth
/Sam