Last active
August 29, 2015 14:27
-
-
Save jwliechty/6ae815e1d4b25a5be8c5 to your computer and use it in GitHub Desktop.
Slow Teaspoon Test Reporter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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; | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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