Created
January 25, 2012 14:56
-
-
Save searls/1676629 to your computer and use it in GitHub Desktop.
just used this for profiling jasmine specs (trying to isolate slow specs)
This file contains hidden or 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
| //outside of any describe() block so they run for every single spec. | |
| beforeEach(function() { | |
| window.timings = window.timings || [] | |
| timings.push({ | |
| startTime: new Date(), | |
| spec: this | |
| }); | |
| }); | |
| afterEach(function() { | |
| _(timings).last()["endTime"] = new Date(); | |
| }); | |
| //laster from the browser console (using Underscore.js) | |
| _(timings).sortBy(function(timing){ timing.elapsedMs = timing.endTime - timing.startTime; return timing.elapsedMs; }); | |
| //^ the above results will be sorted fastest-to-slowest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment