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 @@ -725,18 +725,9 @@ Runner.prototype.uncaught = function(err) {
725
725
this . emit ( 'end' ) ;
726
726
} ;
727
727
728
- /**
729
- * Cleans up the reference to the test's deferred function.
730
- * @see cleanSuiteReferences for details.
731
- * @param {Test } test
732
- */
733
- function cleanTestReferences ( test ) {
734
- delete test . fn ;
735
- }
736
-
737
728
/**
738
729
* Cleans up the references to all the deferred functions
739
- * (before/after/beforeEach/afterEach) of a Suite.
730
+ * (before/after/beforeEach/afterEach) and tests of a Suite.
740
731
* These must be deleted otherwise a memory leak can happen,
741
732
* as those functions may reference variables from closures,
742
733
* thus those variables can never be garbage collected as long
@@ -766,6 +757,10 @@ function cleanSuiteReferences(suite) {
766
757
if ( isArray ( suite . _afterEach ) ) {
767
758
cleanArrReferences ( suite . _afterEach ) ;
768
759
}
760
+
761
+ for ( var i = 0 ; i < suite . tests . length ; i ++ ) {
762
+ delete suite . tests [ i ] . fn ;
763
+ }
769
764
}
770
765
771
766
/**
@@ -800,7 +795,6 @@ Runner.prototype.run = function(fn) {
800
795
debug ( 'start' ) ;
801
796
802
797
// references cleanup to avoid memory leaks
803
- this . on ( 'test end' , cleanTestReferences ) ;
804
798
this . on ( 'suite end' , cleanSuiteReferences ) ;
805
799
806
800
// callback
You can’t perform that action at this time.
0 commit comments