@@ -39,8 +39,9 @@ class CompilerBaselineRunner extends RunnerBase {
39
39
40
40
public checkTestCodeOutput ( fileName : string ) {
41
41
describe ( 'compiler tests for ' + fileName , ( ) => {
42
- // strips the fileName from the path.
43
- var justName = fileName . replace ( / ^ .* [ \\ \/ ] / , '' ) ;
42
+ // Mocha holds onto the closure environment of the describe callback even after the test is done.
43
+ // Everything declared here should be cleared out in the "after" callback.
44
+ var justName = fileName . replace ( / ^ .* [ \\ \/ ] / , '' ) ; // strips the fileName from the path.
44
45
var content = Harness . IO . readFile ( fileName ) ;
45
46
var testCaseContent = Harness . TestCaseParser . makeUnitsFromTest ( content , fileName ) ;
46
47
@@ -122,6 +123,27 @@ class CompilerBaselineRunner extends RunnerBase {
122
123
}
123
124
} ) ;
124
125
126
+ after ( ( ) => {
127
+ // Mocha holds onto the closure environment of the describe callback even after the test is done.
128
+ // Therefore we have to clean out large objects after the test is done.
129
+ justName = undefined ;
130
+ content = undefined ;
131
+ testCaseContent = undefined ;
132
+ units = undefined ;
133
+ tcSettings = undefined ;
134
+ lastUnit = undefined ;
135
+ rootDir = undefined ;
136
+ result = undefined ;
137
+ checker = undefined ;
138
+ options = undefined ;
139
+ toBeCompiled = undefined ;
140
+ otherFiles = undefined ;
141
+ harnessCompiler = undefined ;
142
+ declToBeCompiled = undefined ;
143
+ declOtherFiles = undefined ;
144
+ declResult = undefined ;
145
+ } ) ;
146
+
125
147
function getByteOrderMarkText ( file : Harness . Compiler . GeneratedFile ) : string {
126
148
return file . writeByteOrderMark ? "\u00EF\u00BB\u00BF" : "" ;
127
149
}
0 commit comments