@@ -41,7 +41,7 @@ class CompilerBaselineRunner extends RunnerBase {
4141 }
4242
4343 private makeUnitName ( name : string , root : string ) {
44- return ts . isRootedDiskPath ( name ) ? name : ( root + name ) ;
44+ return ts . isRootedDiskPath ( name ) ? name : ts . combinePaths ( root , name ) ;
4545 } ;
4646
4747 public checkTestCodeOutput ( fileName : string ) {
@@ -58,20 +58,18 @@ class CompilerBaselineRunner extends RunnerBase {
5858 let program : ts . Program ;
5959 let options : ts . CompilerOptions ;
6060 // equivalent to the files that will be passed on the command line
61- let toBeCompiled : { unitName : string ; content : string } [ ] ;
61+ let toBeCompiled : Harness . Compiler . TestFile [ ] ;
6262 // equivalent to other files on the file system not directly passed to the compiler (ie things that are referenced by other files)
63- let otherFiles : { unitName : string ; content : string } [ ] ;
64- let harnessCompiler : Harness . Compiler . HarnessCompiler ;
63+ let otherFiles : Harness . Compiler . TestFile [ ] ;
6564
6665 before ( ( ) => {
6766 justName = fileName . replace ( / ^ .* [ \\ \/ ] / , "" ) ; // strips the fileName from the path.
6867 const content = Harness . IO . readFile ( fileName ) ;
6968 const testCaseContent = Harness . TestCaseParser . makeUnitsFromTest ( content , fileName ) ;
7069 const units = testCaseContent . testUnitData ;
71- tcSettings = testCaseContent . settings ;
70+ harnessSettings = testCaseContent . settings ;
7271 lastUnit = units [ units . length - 1 ] ;
7372 const rootDir = lastUnit . originalFilePath . indexOf ( "conformance" ) === - 1 ? "tests/cases/compiler/" : lastUnit . originalFilePath . substring ( 0 , lastUnit . originalFilePath . lastIndexOf ( "/" ) ) + "/" ;
74- harnessCompiler = Harness . Compiler . getCompiler ( ) ;
7573 // 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)
7674 // 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,
7775 // otherwise, assume all files are just meant to be in the same compilation session without explicit references to one another.
@@ -91,34 +89,32 @@ class CompilerBaselineRunner extends RunnerBase {
9189 } ) ;
9290 }
9391
94- options = harnessCompiler . compileFiles ( toBeCompiled , otherFiles , function ( compileResult , _program ) {
95- result = compileResult ;
96- // The program will be used by typeWriter
97- program = _program ;
98- } , function ( settings ) {
99- harnessCompiler . setCompilerSettings ( tcSettings ) ;
100- } ) ;
92+ const output = Harness . Compiler . HarnessCompiler . compileFiles (
93+ toBeCompiled , otherFiles , harnessSettings , /* options */ undefined , /* currentDirectory */ undefined ) ;
94+
95+ options = output . options ;
96+ result = output . result ;
97+ program = output . program ;
10198 } ) ;
10299
103100 after ( ( ) => {
104101 // Mocha holds onto the closure environment of the describe callback even after the test is done.
105102 // Therefore we have to clean out large objects after the test is done.
106103 justName = undefined ;
107- tcSettings = undefined ;
104+ harnessSettings = undefined ;
108105 lastUnit = undefined ;
109106 result = undefined ;
110107 program = undefined ;
111108 options = undefined ;
112109 toBeCompiled = undefined ;
113110 otherFiles = undefined ;
114- harnessCompiler = undefined ;
115111 } ) ;
116112
117113 function getByteOrderMarkText ( file : Harness . Compiler . GeneratedFile ) : string {
118114 return file . writeByteOrderMark ? "\u00EF\u00BB\u00BF" : "" ;
119115 }
120116
121- function getErrorBaseline ( toBeCompiled : { unitName : string ; content : string } [ ] , otherFiles : { unitName : string ; content : string } [ ] , result : Harness . Compiler . CompilerResult ) {
117+ function getErrorBaseline ( toBeCompiled : Harness . Compiler . TestFile [ ] , otherFiles : Harness . Compiler . TestFile [ ] , result : Harness . Compiler . CompilerResult ) {
122118 return Harness . Compiler . getErrorBaseline ( toBeCompiled . concat ( otherFiles ) , result . errors ) ;
123119 }
124120
@@ -180,9 +176,9 @@ class CompilerBaselineRunner extends RunnerBase {
180176 }
181177 }
182178
183- const declFileCompilationResult = harnessCompiler . compileDeclarationFiles ( toBeCompiled , otherFiles , result , function ( settings ) {
184- harnessCompiler . setCompilerSettings ( tcSettings ) ;
185- } , options ) ;
179+ const declFileCompilationResult =
180+ Harness . Compiler . HarnessCompiler . compileDeclarationFiles (
181+ toBeCompiled , otherFiles , result , harnessSettings , options , /* currentDirectory */ undefined ) ;
186182
187183 if ( declFileCompilationResult && declFileCompilationResult . declResult . errors . length ) {
188184 jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n" ;
@@ -363,7 +359,6 @@ class CompilerBaselineRunner extends RunnerBase {
363359 public initializeTests ( ) {
364360 describe ( this . testSuiteName + " tests" , ( ) => {
365361 describe ( "Setup compiler for compiler baselines" , ( ) => {
366- const harnessCompiler = Harness . Compiler . getCompiler ( ) ;
367362 this . parseOptions ( ) ;
368363 } ) ;
369364
0 commit comments