@@ -1370,23 +1370,31 @@ namespace Harness {
13701370
13711371 // Produce baselines. The first gives the types for all expressions.
13721372 // The second gives symbols for all identifiers.
1373- let e1 : Error , e2 : Error ;
1373+ let typesError : Error , symbolsError : Error ;
13741374 try {
13751375 checkBaseLines ( /*isSymbolBaseLine*/ false ) ;
13761376 }
13771377 catch ( e ) {
1378- e1 = e ;
1378+ typesError = e ;
13791379 }
13801380
13811381 try {
13821382 checkBaseLines ( /*isSymbolBaseLine*/ true ) ;
13831383 }
13841384 catch ( e ) {
1385- e2 = e ;
1385+ symbolsError = e ;
13861386 }
13871387
1388- if ( e1 || e2 ) {
1389- throw e1 || e2 ;
1388+ if ( typesError && symbolsError ) {
1389+ throw new Error ( typesError . message + ts . sys . newLine + symbolsError . message ) ;
1390+ }
1391+
1392+ if ( typesError ) {
1393+ throw typesError ;
1394+ }
1395+
1396+ if ( symbolsError ) {
1397+ throw symbolsError ;
13901398 }
13911399
13921400 return ;
@@ -1396,7 +1404,12 @@ namespace Harness {
13961404
13971405 const fullExtension = isSymbolBaseLine ? ".symbols" : ".types" ;
13981406
1399- Harness . Baseline . runBaseline ( baselinePath . replace ( / \. t s x ? / , fullExtension ) , ( ) => fullBaseLine , opts ) ;
1407+ // When calling this function from rwc-runner, the baselinePath will have no extension.
1408+ // As rwc test- file is stored in json which ".json" will get stripped off.
1409+ // When calling this function from compiler-runner, the baselinePath will then has either ".ts" or ".tsx" extension
1410+ const outputFileName = ts . endsWith ( baselinePath , ".ts" ) || ts . endsWith ( baselinePath , ".tsx" ) ?
1411+ baselinePath . replace ( / \. t s x ? / , fullExtension ) : baselinePath . concat ( fullExtension ) ;
1412+ Harness . Baseline . runBaseline ( outputFileName , ( ) => fullBaseLine , opts ) ;
14001413 }
14011414
14021415 function generateBaseLine ( typeWriterResults : ts . Map < TypeWriterResult [ ] > , isSymbolBaseline : boolean ) : string {
0 commit comments