Skip to content

Instantly share code, notes, and snippets.

@jwliechty
Last active August 29, 2015 14:27
Show Gist options
  • Save jwliechty/6ae815e1d4b25a5be8c5 to your computer and use it in GitHub Desktop.
Save jwliechty/6ae815e1d4b25a5be8c5 to your computer and use it in GitHub Desktop.
Slow Teaspoon Test Reporter
(function(){
var duration = $('#teaspoon-stats-duration').text();
var naughty = $('.slow span');
var worst = $.makeArray(naughty.map(function(){return parseInt($(this).text().replace('ms', ''))}).sort(function(a, b){return b - a})).slice(0, 5).join(', ');
console.log('duration: ' + duration);
console.log('count: ' + naughty.size());
console.log('worst: ' + worst);
return null;
}());
(function($){
function sortByTime(a, b){
return getTime(b) - getTime(a);
}
function getTime(item){
return parseInt($(item).text().replace('ms', ''));
}
function getTestName(){
return $(this).closest('#teaspoon-report-all > .suite').find('h1:first').text();
}
function printResult(){
console.log('' + this);
}
$.unique($('.slow span').sort(sortByTime).map(getTestName)).each(printResult);
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment