File tree 1 file changed +5
-11
lines changed
1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -5058,18 +5058,9 @@ Runner.prototype.uncaught = function(err) {
5058
5058
this . emit ( 'end' ) ;
5059
5059
} ;
5060
5060
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
-
5070
5061
/**
5071
5062
* 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.
5073
5064
* These must be deleted otherwise a memory leak can happen,
5074
5065
* as those functions may reference variables from closures,
5075
5066
* thus those variables can never be garbage collected as long
@@ -5099,6 +5090,10 @@ function cleanSuiteReferences(suite) {
5099
5090
if ( isArray ( suite . _afterEach ) ) {
5100
5091
cleanArrReferences ( suite . _afterEach ) ;
5101
5092
}
5093
+
5094
+ for ( var i = 0 ; i < suite . tests . length ; i ++ ) {
5095
+ delete suite . tests [ i ] . fn ;
5096
+ }
5102
5097
}
5103
5098
5104
5099
/**
@@ -5133,7 +5128,6 @@ Runner.prototype.run = function(fn) {
5133
5128
debug ( 'start' ) ;
5134
5129
5135
5130
// references cleanup to avoid memory leaks
5136
- this . on ( 'test end' , cleanTestReferences ) ;
5137
5131
this . on ( 'suite end' , cleanSuiteReferences ) ;
5138
5132
5139
5133
// callback
You can’t perform that action at this time.
0 commit comments