or better yet, why not just delegate to 'console' if globally available:
QUnit.log = (console&&console.log)?
function(result, msg){console.log('['+!!result+'] '+msg);}:
function(result, msg){};
then we still have a global hook to logging while keeping it inside the
QUnit namespace internally.
On Tue, May 12, 2009 at 10:59 PM, chris thatcher <
[email protected]> wrote:
> I noticed we where using an older testrunner.js with envjs even when
> running 1.3.2 unit tests. i start playing with it and realized qunit works
> great and i can even use QUnit.done to output a static html file with the
> result of running the tests in envjs. the only snag I had was being able to
> hook to QUnit.log . this may be a bug with envjs implementation of onload
> so please feel free to point out if im mistaken.
>
> here is the script that initiates it:
>
> load("build/runtest/env.js");
>
> (function($env){
>
> //let it load the script from the html
> $env.scriptTypes = {
> "text/javascript" :true
> };
>
> var count = 0;
> window.onload = function(){
>
> //this doesnt work because onload isn't called until after the
> tests run
> QUnit.log = function(result, message){
> $env.log('('+(count++)+')['+((!!result)?'PASS':'FAIL')+'] ' +
> message );
> };
>
> //this works because done is called from syncronize()
> QUnit.done = function(pass, fail){
> //write resulting window less scripts to an html file
> jQuery('script').each(function(){
> this.type = 'text/envjs';
> });
> $env.writeToFile(
> document.documentElement.xml,
> $env.location('jqenv.html')
> );
> };
>
> };
>
> window.location = "test/index.html";
>
> })(__env__);
>
>
> I was wondering if you could either add a synchronized 'begin' or let log
> just be global
>
> $.extend(window, {
> ///...
> log: log?log:function(result, message);
> });
>
> thanks
> thatcher
> --
> Christopher Thatcher
>
--
Christopher Thatcher
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---