I have an AngularJS application with about 2000 unit tests which consume a lot of memory. Once tests launched, they run pretty fast (in Chrome) until memory consumption hits 1.5GB at which point every test starts to take about 3 seconds.
Now, I'm pretty damn sure this is not related to Why are my AngularJS, Karma / Jasmine tests running so slowly?.
At this point I have no idea if it's the tests that are leaking or the application itself. I would like to profile the test execution.
I've read unit-tests karma-runner/jasmine profiling and am trying to do the following:
You can use localhost:9876/debug.html and profile the memory. Check the memory before executing (after Jasmine executed all the
describe()
blocks and collected the tests) and then after executing the tests - it should be the same.
But how can this be done?
I don't really understand how it is possible to check before and after. Can I somehow pause the tests execution? Is jasmine able to tell me when it's "collected the tests" and wait for me to do the profiling?
Or is there any other approach?
This is not a full answer but just "thinking out loud"...
beforeEach
or afterEach
trigger and shutdown the profiler (using a a suite + test name for each profiling): see the console.profile(\[label\])
and console.profileEnd()
calls. Once found the place where the memory goes up you can focus the area and probably start debugging in a more specific way...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With