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 {
1866
1866
let sourceMapText : string ;
1867
1867
// Create a compilerHost object to allow the compiler to read and write files
1868
1868
let compilerHost : CompilerHost = {
1869
- getSourceFile : ( fileName , target ) => fileName === inputFileName ? sourceFile : undefined ,
1869
+ getSourceFile : ( fileName , target ) => fileName === normalizeSlashes ( inputFileName ) ? sourceFile : undefined ,
1870
1870
writeFile : ( name , text , writeByteOrderMark ) => {
1871
1871
if ( fileExtensionIs ( name , ".map" ) ) {
1872
1872
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 {
64
64
let transpileModuleResultWithSourceMap = transpileModule ( input , transpileOptions ) ;
65
65
assert . isTrue ( transpileModuleResultWithSourceMap . sourceMapText !== undefined ) ;
66
66
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 } ` ;
69
69
70
70
if ( testSettings . expectedOutput !== undefined ) {
71
71
assert . equal ( transpileModuleResultWithSourceMap . outputText , testSettings . expectedOutput + expectedSourceMappingUrlLine ) ;
@@ -270,5 +270,9 @@ var x = 0;`,
270
270
expectedOutput : output
271
271
} ) ;
272
272
} ) ;
273
+
274
+ it ( "Supports backslashes in file name" , ( ) => {
275
+ test ( "var x" , { expectedOutput : "var x;\r\n" , options : { fileName : "a\\b.ts" } } ) ;
276
+ } ) ;
273
277
} ) ;
274
278
}
You can’t perform that action at this time.
0 commit comments