@@ -45,14 +45,10 @@ class CompilerBaselineRunner extends RunnerBase {
4545 // Mocha holds onto the closure environment of the describe callback even after the test is done.
4646 // Everything declared here should be cleared out in the "after" callback.
4747 let justName : string ;
48- let content : string ;
49- let testCaseContent : { settings : Harness . TestCaseParser . CompilerSettings ; testUnitData : Harness . TestCaseParser . TestUnitData [ ] ; } ;
5048
51- let units : Harness . TestCaseParser . TestUnitData [ ] ;
5249 let tcSettings : Harness . TestCaseParser . CompilerSettings ;
5350
5451 let lastUnit : Harness . TestCaseParser . TestUnitData ;
55- let rootDir : string ;
5652
5753 let result : Harness . Compiler . CompilerResult ;
5854 let program : ts . Program ;
@@ -65,29 +61,29 @@ class CompilerBaselineRunner extends RunnerBase {
6561
6662 before ( ( ) => {
6763 justName = fileName . replace ( / ^ .* [ \\ \/ ] / , "" ) ; // strips the fileName from the path.
68- content = Harness . IO . readFile ( fileName ) ;
69- testCaseContent = Harness . TestCaseParser . makeUnitsFromTest ( content , fileName ) ;
70- units = testCaseContent . testUnitData ;
64+ const content = Harness . IO . readFile ( fileName ) ;
65+ const testCaseContent = Harness . TestCaseParser . makeUnitsFromTest ( content , fileName ) ;
66+ const units = testCaseContent . testUnitData ;
7167 tcSettings = testCaseContent . settings ;
7268 lastUnit = units [ units . length - 1 ] ;
73- rootDir = lastUnit . originalFilePath . indexOf ( "conformance" ) === - 1 ? "tests/cases/compiler/" : lastUnit . originalFilePath . substring ( 0 , lastUnit . originalFilePath . lastIndexOf ( "/" ) ) + "/" ;
69+ const rootDir = lastUnit . originalFilePath . indexOf ( "conformance" ) === - 1 ? "tests/cases/compiler/" : lastUnit . originalFilePath . substring ( 0 , lastUnit . originalFilePath . lastIndexOf ( "/" ) ) + "/" ;
7470 harnessCompiler = Harness . Compiler . getCompiler ( ) ;
7571 // We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test)
7672 // If the last file in a test uses require or a triple slash reference we'll assume all other files will be brought in via references,
7773 // otherwise, assume all files are just meant to be in the same compilation session without explicit references to one another.
7874 toBeCompiled = [ ] ;
7975 otherFiles = [ ] ;
8076 if ( / r e q u i r e \( / . test ( lastUnit . content ) || / r e f e r e n c e \s p a t h / . test ( lastUnit . content ) ) {
81- toBeCompiled . push ( { unitName : rootDir + lastUnit . name , content : lastUnit . content } ) ;
77+ toBeCompiled . push ( { unitName : ts . isRootedDiskPath ( lastUnit . name ) ? lastUnit . name : rootDir + lastUnit . name , content : lastUnit . content } ) ;
8278 units . forEach ( unit => {
8379 if ( unit . name !== lastUnit . name ) {
84- otherFiles . push ( { unitName : rootDir + unit . name , content : unit . content } ) ;
80+ otherFiles . push ( { unitName : ts . isRootedDiskPath ( unit . name ) ? unit . name : rootDir + unit . name , content : unit . content } ) ;
8581 }
8682 } ) ;
8783 }
8884 else {
8985 toBeCompiled = units . map ( unit => {
90- return { unitName : rootDir + unit . name , content : unit . content } ;
86+ return { unitName : ts . isRootedDiskPath ( unit . name ) ? unit . name : rootDir + unit . name , content : unit . content } ;
9187 } ) ;
9288 }
9389
@@ -104,12 +100,8 @@ class CompilerBaselineRunner extends RunnerBase {
104100 // Mocha holds onto the closure environment of the describe callback even after the test is done.
105101 // Therefore we have to clean out large objects after the test is done.
106102 justName = undefined ;
107- content = undefined ;
108- testCaseContent = undefined ;
109- units = undefined ;
110103 tcSettings = undefined ;
111104 lastUnit = undefined ;
112- rootDir = undefined ;
113105 result = undefined ;
114106 program = undefined ;
115107 options = undefined ;
0 commit comments