Skip to content

Commit a25ac95

Browse files
committed
Build browser mocha for 2.4.0
1 parent aa25b1c commit a25ac95

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

mocha.js

+5-11
Original file line numberDiff line numberDiff line change
@@ -5058,18 +5058,9 @@ Runner.prototype.uncaught = function(err) {
50585058
this.emit('end');
50595059
};
50605060

5061-
/**
5062-
* Cleans up the reference to the test's deferred function.
5063-
* @see cleanSuiteReferences for details.
5064-
* @param {Test} test
5065-
*/
5066-
function cleanTestReferences(test) {
5067-
delete test.fn;
5068-
}
5069-
50705061
/**
50715062
* Cleans up the references to all the deferred functions
5072-
* (before/after/beforeEach/afterEach) of a Suite.
5063+
* (before/after/beforeEach/afterEach) and tests of a Suite.
50735064
* These must be deleted otherwise a memory leak can happen,
50745065
* as those functions may reference variables from closures,
50755066
* thus those variables can never be garbage collected as long
@@ -5099,6 +5090,10 @@ function cleanSuiteReferences(suite) {
50995090
if (isArray(suite._afterEach)) {
51005091
cleanArrReferences(suite._afterEach);
51015092
}
5093+
5094+
for (var i = 0; i < suite.tests.length; i++) {
5095+
delete suite.tests[i].fn;
5096+
}
51025097
}
51035098

51045099
/**
@@ -5133,7 +5128,6 @@ Runner.prototype.run = function(fn) {
51335128
debug('start');
51345129

51355130
// references cleanup to avoid memory leaks
5136-
this.on('test end', cleanTestReferences);
51375131
this.on('suite end', cleanSuiteReferences);
51385132

51395133
// callback

0 commit comments

Comments
 (0)