Merge branch 'baselining' into resolution

This commit is contained in:
Sheetal Nandi
2019-09-25 08:10:11 -07:00
120 changed files with 739 additions and 730 deletions

View File

@@ -316,7 +316,7 @@ namespace ts {
*/
export function createBuilderStatusReporter(system: System, pretty?: boolean): DiagnosticReporter {
return diagnostic => {
let output = pretty ? `[${formatColorAndReset((system.now ? system.now() : new Date()).toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] ` : `${(system.now ? system.now() : new Date()).toLocaleTimeString()} - `;
let output = pretty ? `[${formatColorAndReset(getLocaleTimeString(system), ForegroundColorEscapeSequences.Grey)}] ` : `${getLocaleTimeString(system)} - `;
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${system.newLine + system.newLine}`;
system.write(output);
};

View File

@@ -54,6 +54,15 @@ namespace ts {
: newLine;
}
/**
* Get locale specific time based on whether we are in test mode
*/
export function getLocaleTimeString(system: System) {
return !system.now ?
new Date().toLocaleTimeString() :
system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
}
/**
* Create a function that reports watch status by writing to the system and handles the formating of the diagnostic
*/
@@ -61,7 +70,7 @@ namespace ts {
return pretty ?
(diagnostic, newLine, options) => {
clearScreenIfNotWatchingForFileChanges(system, diagnostic, options);
let output = `[${formatColorAndReset(new Date().toLocaleTimeString(), ForegroundColorEscapeSequences.Grey)}] `;
let output = `[${formatColorAndReset(getLocaleTimeString(system), ForegroundColorEscapeSequences.Grey)}] `;
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${newLine + newLine}`;
system.write(output);
} :
@@ -72,7 +81,7 @@ namespace ts {
output += newLine;
}
output += `${new Date().toLocaleTimeString()} - `;
output += `${getLocaleTimeString(system)} - `;
output += `${flattenDiagnosticMessageText(diagnostic.messageText, system.newLine)}${getPlainDiagnosticFollowingNewLines(diagnostic, newLine)}`;
system.write(output);