Reputation: 56478
I've been using the YUI Test framework to do TDD with JavaScript but the default TestLogger shows all sorts of messages, not just the FAIL ones. This makes scanning the log for failures an exercise in tedium, or you have to play whack-a-mole on the filter checkboxes. Is there any way to make the toggle switches on the logger window stay the same between page refreshes? Or have the Logger only show the tests that have failed?
You can see in this example that the PASS and INFO dominate when you have several tests and it is too easy to miss the FAIL messages.
YUI Test Logger screenshot http://img24.imageshack.us/img24/935/yuitest.png
I've looked at the API for the TestLogger, which hints at there being some options. Sadly the options are not described at all. I only use YUI for this feature so I'm not an expert in the API, so can anyone lend me a hand?
Upvotes: 0
Views: 185
Reputation: 2581
To filter a category in YUI 2.7 and prior, Logger must have received a message from that category before the request to hide. That means you can do
YAHOO.log('','pass','TestRunner');
var logger = new YAHOO.widget.LogReader(el,conf);
logger.hideCategory('pass');
FWIW, pre-filtering is available in YUI 3 with Console + ConsoleFilters plugin.
I would recommend you add a feature request on yuilibrary.com at http://yuilibrary.com/projects/yui2/newticket
Upvotes: 1
Reputation: 532605
Looks to me that the TestLogger class (see source) extends the Logger class. The options, therefore, ought to be those that apply to the Logger class. I think what you want is to set the categories option to only show fail
messages.
var logger = new YAHOO.tool.TestLogger( element, { categories: ['fail'] } );
Upvotes: 0