mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-15 12:53:27 -05:00
Update emitting timestamps during testing
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user