From 0654e6c7c5204d5e300dd353c6cdb8bfe5ebf85e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 6 Jul 2018 18:40:47 -0700 Subject: [PATCH] Ensure default os-invariant value for newLine in project tests --- src/compiler/sourcemapDecoder.ts | 4 ++-- src/testRunner/projectsRunner.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index b09b919e0e0..1640d39c52d 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -72,7 +72,7 @@ namespace ts.sourcemaps { if (!maps[targetIndex] || comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) { return loc; } - return { fileName: toPath(map.file!, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos + return { fileName: toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos } function getOriginalPosition(loc: SourceMappableLocation): SourceMappableLocation { @@ -129,7 +129,7 @@ namespace ts.sourcemaps { function processPosition(position: RawSourceMapPosition): ProcessedSourceMapPosition { const sourcePath = map.sources[position.sourceIndex]; return { - emittedPosition: getPositionOfLineAndCharacterUsingName(map.file!, currentDirectory, position.emittedLine, position.emittedColumn), + emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn), sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn), sourcePath, // TODO: Consider using `name` field to remap the expected identifier to scan for renames to handle another tool renaming oout output diff --git a/src/testRunner/projectsRunner.ts b/src/testRunner/projectsRunner.ts index f3b4a0bca23..62a186d4526 100644 --- a/src/testRunner/projectsRunner.ts +++ b/src/testRunner/projectsRunner.ts @@ -431,6 +431,7 @@ namespace project { skipDefaultLibCheck: false, moduleResolution: ts.ModuleResolutionKind.Classic, module: moduleKind, + newLine: ts.NewLineKind.CarriageReturnLineFeed, mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? vpath.resolve(vfs.srcFolder, testCase.mapRoot) : testCase.mapRoot,