@@ -1370,23 +1370,31 @@ namespace Harness {
1370
1370
1371
1371
// Produce baselines. The first gives the types for all expressions.
1372
1372
// The second gives symbols for all identifiers.
1373
- let e1 : Error , e2 : Error ;
1373
+ let typesError : Error , symbolsError : Error ;
1374
1374
try {
1375
1375
checkBaseLines ( /*isSymbolBaseLine*/ false ) ;
1376
1376
}
1377
1377
catch ( e ) {
1378
- e1 = e ;
1378
+ typesError = e ;
1379
1379
}
1380
1380
1381
1381
try {
1382
1382
checkBaseLines ( /*isSymbolBaseLine*/ true ) ;
1383
1383
}
1384
1384
catch ( e ) {
1385
- e2 = e ;
1385
+ symbolsError = e ;
1386
1386
}
1387
1387
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 ;
1390
1398
}
1391
1399
1392
1400
return ;
@@ -1396,7 +1404,12 @@ namespace Harness {
1396
1404
1397
1405
const fullExtension = isSymbolBaseLine ? ".symbols" : ".types" ;
1398
1406
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 ) ;
1400
1413
}
1401
1414
1402
1415
function generateBaseLine ( typeWriterResults : ts . Map < TypeWriterResult [ ] > , isSymbolBaseline : boolean ) : string {
0 commit comments