How to tell which tests take the most time in jasmine?


I noticed that the whole suite of Jasmine tests started taking more time that I would like, but I'm not sure, which ones actually cause the delay. Is there a way to find that out without running each test individually?

Problem courtesy of: Fluffy


The basic ConsoleReporter only reports the time elapsed for all the tests, but if you look at the source code of it you will see it's quite easy to modify to add the elapsed time for each spec. Basically what you need to do is to log the time a spec start when the function reportSpecStarting (that's just before a spec starts to run) is called and output the difference when the function reportSpecResults (that's just after a spec has finished running).

So if you modified the ConsoleReporter with this, it would output you the name of each specification with their elapsed time :

this.reportSpecStarting = function() {
    this.specStartingTime =;

this.reportSpecResults = function(spec) {
    var results = spec.results();

    print(results.description + " ");

    if (results.skipped) {
    } else if (results.passed()) {
    } else {

    print(" (" + ( - this.specStartingTime) + "ms)");
Solution courtesy of: HoLyVieR


what about using Jasmines HTMLReporter? (down towards the bottom)

hmmm.. maybe you can loop it so each file is executed individually? (not the best answer :( )

Discussion courtesy of: thescientist

This recipe can be found in it's original form on Stack Over Flow.