File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1866,7 +1866,7 @@ namespace ts {
18661866 let sourceMapText : string ;
18671867 // Create a compilerHost object to allow the compiler to read and write files
18681868 let compilerHost : CompilerHost = {
1869- getSourceFile : ( fileName , target ) => fileName === inputFileName ? sourceFile : undefined ,
1869+ getSourceFile : ( fileName , target ) => fileName === normalizeSlashes ( inputFileName ) ? sourceFile : undefined ,
18701870 writeFile : ( name , text , writeByteOrderMark ) => {
18711871 if ( fileExtensionIs ( name , ".map" ) ) {
18721872 Debug . assert ( sourceMapText === undefined , `Unexpected multiple source map outputs for the file '${ name } '` ) ;
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ module ts {
6464 let transpileModuleResultWithSourceMap = transpileModule ( input , transpileOptions ) ;
6565 assert . isTrue ( transpileModuleResultWithSourceMap . sourceMapText !== undefined ) ;
6666
67- let expectedSourceMapFileName = removeFileExtension ( transpileOptions . fileName ) + ".js.map" ;
68- let expectedSourceMappingUrlLine = `//# sourceMappingURL=${ expectedSourceMapFileName } ` ;
67+ let expectedSourceMapFileName = removeFileExtension ( getBaseFileName ( normalizeSlashes ( transpileOptions . fileName ) ) ) + ".js.map" ;
68+ let expectedSourceMappingUrlLine = `//# sourceMappingURL=${ expectedSourceMapFileName } ` ;
6969
7070 if ( testSettings . expectedOutput !== undefined ) {
7171 assert . equal ( transpileModuleResultWithSourceMap . outputText , testSettings . expectedOutput + expectedSourceMappingUrlLine ) ;
@@ -270,5 +270,9 @@ var x = 0;`,
270270 expectedOutput : output
271271 } ) ;
272272 } ) ;
273+
274+ it ( "Supports backslashes in file name" , ( ) => {
275+ test ( "var x" , { expectedOutput : "var x;\r\n" , options : { fileName : "a\\b.ts" } } ) ;
276+ } ) ;
273277 } ) ;
274278}
You can’t perform that action at this time.
0 commit comments