@@ -470,19 +470,6 @@ namespace Utils {
470
470
}
471
471
}
472
472
473
- namespace Harness . Path {
474
- export function getFileName ( fullPath : string ) {
475
- return fullPath . replace ( / ^ .* [ \\ \/ ] / , "" ) ;
476
- }
477
-
478
- export function filePath ( fullPath : string ) {
479
- fullPath = ts . normalizeSlashes ( fullPath ) ;
480
- const components = fullPath . split ( "/" ) ;
481
- const path : string [ ] = components . slice ( 0 , components . length - 1 ) ;
482
- return path . join ( "/" ) + "/" ;
483
- }
484
- }
485
-
486
473
namespace Harness {
487
474
export interface IO {
488
475
newLine ( ) : string ;
@@ -1090,7 +1077,9 @@ namespace Harness {
1090
1077
{ name : "suppressOutputPathCheck" , type : "boolean" } ,
1091
1078
{ name : "noImplicitReferences" , type : "boolean" } ,
1092
1079
{ name : "currentDirectory" , type : "string" } ,
1093
- { name : "symlink" , type : "string" }
1080
+ { name : "symlink" , type : "string" } ,
1081
+ // Emitted js baseline will print full paths for every output file
1082
+ { name : "fullEmitPaths" , type : "boolean" }
1094
1083
] ;
1095
1084
1096
1085
let optionsIndex : ts . Map < ts . CommandLineOption > ;
@@ -1588,7 +1577,7 @@ namespace Harness {
1588
1577
1589
1578
let sourceMapCode = "" ;
1590
1579
for ( let i = 0 ; i < result . sourceMaps . length ; i ++ ) {
1591
- sourceMapCode += "//// [" + Harness . Path . getFileName ( result . sourceMaps [ i ] . fileName ) + "]\r\n" ;
1580
+ sourceMapCode += "//// [" + ts . getBaseFileName ( result . sourceMaps [ i ] . fileName ) + "]\r\n" ;
1592
1581
sourceMapCode += getByteOrderMarkText ( result . sourceMaps [ i ] ) ;
1593
1582
sourceMapCode += result . sourceMaps [ i ] . code ;
1594
1583
}
@@ -1611,21 +1600,22 @@ namespace Harness {
1611
1600
tsCode += "//// [" + header + "] ////\r\n\r\n" ;
1612
1601
}
1613
1602
for ( let i = 0 ; i < tsSources . length ; i ++ ) {
1614
- tsCode += "//// [" + Harness . Path . getFileName ( tsSources [ i ] . unitName ) + "]\r\n" ;
1603
+ tsCode += "//// [" + ts . getBaseFileName ( tsSources [ i ] . unitName ) + "]\r\n" ;
1615
1604
tsCode += tsSources [ i ] . content + ( i < ( tsSources . length - 1 ) ? "\r\n" : "" ) ;
1616
1605
}
1617
1606
1618
1607
let jsCode = "" ;
1619
- for ( let i = 0 ; i < result . files . length ; i ++ ) {
1620
- jsCode += "//// [" + Harness . Path . getFileName ( result . files [ i ] . fileName ) + "]\r\n" ;
1621
- jsCode += getByteOrderMarkText ( result . files [ i ] ) ;
1622
- jsCode += result . files [ i ] . code ;
1608
+ for ( const file of result . files ) {
1609
+ const fileName = harnessSettings [ "fullEmitPaths" ] ? file . fileName : ts . getBaseFileName ( file . fileName ) ;
1610
+ jsCode += "//// [" + fileName + "]\r\n" ;
1611
+ jsCode += getByteOrderMarkText ( file ) ;
1612
+ jsCode += file . code ;
1623
1613
}
1624
1614
1625
1615
if ( result . declFilesCode . length > 0 ) {
1626
1616
jsCode += "\r\n\r\n" ;
1627
1617
for ( let i = 0 ; i < result . declFilesCode . length ; i ++ ) {
1628
- jsCode += "//// [" + Harness . Path . getFileName ( result . declFilesCode [ i ] . fileName ) + "]\r\n" ;
1618
+ jsCode += "//// [" + ts . getBaseFileName ( result . declFilesCode [ i ] . fileName ) + "]\r\n" ;
1629
1619
jsCode += getByteOrderMarkText ( result . declFilesCode [ i ] ) ;
1630
1620
jsCode += result . declFilesCode [ i ] . code ;
1631
1621
}
@@ -1848,7 +1838,7 @@ namespace Harness {
1848
1838
}
1849
1839
1850
1840
// normalize the fileName for the single file case
1851
- currentFileName = testUnitData . length > 0 || currentFileName ? currentFileName : Path . getFileName ( fileName ) ;
1841
+ currentFileName = testUnitData . length > 0 || currentFileName ? currentFileName : ts . getBaseFileName ( fileName ) ;
1852
1842
1853
1843
// EOF, push whatever remains
1854
1844
const newTestFile2 = {
@@ -2012,7 +2002,7 @@ namespace Harness {
2012
2002
2013
2003
export function isDefaultLibraryFile ( filePath : string ) : boolean {
2014
2004
// We need to make sure that the filePath is prefixed with "lib." not just containing "lib." and end with ".d.ts"
2015
- const fileName = Path . getFileName ( filePath ) ;
2005
+ const fileName = ts . getBaseFileName ( filePath ) ;
2016
2006
return ts . startsWith ( fileName , "lib." ) && ts . endsWith ( fileName , ".d.ts" ) ;
2017
2007
}
2018
2008
0 commit comments