Greatings.
We have a fairly large JS codebase (few hundred js files) with several thousand jasmine 1.3.x specs. We discovered recently that we were running out of memory on certain devices while running tests due to the way we were writing certain async specs. It was our own fault (or rather misunderstanding), but it is what it is, and we don't have time to fix all the tests or migrate to 2.0, so I'm looking for a workaround.
the faulty tests look something like this:
it("...", function () {
var instance = new ...;
waitsFor(function () {});
runs(function () { ... (doesnt clear instance) });
});
Imagine instance is a fairly large object (with native resources) and several thousand tests have run. Jasmine holds onto all suites, which hold onto specs, which hold onto blocks, which (in our case) capture the instance. Even after the specs have completed, jasmine continues to hold a reference, and after a while we run out of memory (on a device with <512MB available).
Of course if time wasn't a factor we'd fix the specs to clean up properly, but given the circumstances I'm looking for a cheaper short term alternative.
My proposed solution is to modify our fork of jasmine 1.3.x to release the func/latchFunction references after completion for Blocks and WaitsForBlocks respectively. I'm wondering if there might be any hidden down-sides to this solution. AFAIK we don't have anything in our workflow that would run the specs multiple times without a page refresh, but I'm assuming there is some reason why jasmine holds onto these after completion.
Thoughts?
-Brandon