Skip to content

Commit 37add88

Browse files
committed
Update tests baselines
1 parent bf567b8 commit 37add88

File tree

5 files changed

+21
-22
lines changed

5 files changed

+21
-22
lines changed

src/compiler/program.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace ts {
6363
interface OutputFingerprint {
6464
hash: string;
6565
byteOrderMark: boolean;
66-
mtime: Date | undefined;
66+
mtime: Date;
6767
}
6868

6969
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
@@ -128,15 +128,14 @@ namespace ts {
128128
if (fingerprint &&
129129
fingerprint.byteOrderMark === writeByteOrderMark &&
130130
fingerprint.hash === hash &&
131-
fingerprint.mtime !== undefined &&
132131
fingerprint.mtime.getTime() === mtimeBefore.getTime()) {
133132
return;
134133
}
135134
}
136135

137136
sys.writeFile(fileName, data, writeByteOrderMark);
138137

139-
const mtimeAfter = sys.getModifiedTime!(fileName); // TODO: GH#18217
138+
const mtimeAfter = sys.getModifiedTime!(fileName) || missingFileModifiedTime; // TODO: GH#18217
140139

141140
outputFingerprints.set(fileName, {
142141
hash,

src/compiler/tsbuild.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -843,12 +843,14 @@ namespace ts {
843843
return buildHost.message(Diagnostics.A_non_dry_build_would_build_project_0, proj.options.configFilePath!);
844844
}
845845

846-
if (context.options.verbose) buildHost.verbose(Diagnostics.Updating_output_timestamps_of_project_0, proj.options.configFilePath!);
846+
if (context.options.verbose) {
847+
buildHost.verbose(Diagnostics.Updating_output_timestamps_of_project_0, proj.options.configFilePath!);
848+
}
849+
847850
const now = new Date();
848851
const outputs = getAllProjectOutputs(proj);
849852
let priorNewestUpdateTime = minimumDate;
850853
for (const file of outputs) {
851-
852854
if (isDeclarationFile(file)) {
853855
const fileModifiedTime = compilerHost.getModifiedTime!(file);
854856
if (fileModifiedTime !== undefined) {
@@ -1062,8 +1064,8 @@ namespace ts {
10621064
};
10631065
}
10641066

1065-
const inputTime = host.getModifiedTime(inputFile);
1066-
if (inputTime !== undefined && inputTime > newestInputFileTime) {
1067+
const inputTime = host.getModifiedTime(inputFile) || missingFileModifiedTime;
1068+
if (inputTime > newestInputFileTime) {
10671069
newestInputFileName = inputFile;
10681070
newestInputFileTime = inputTime;
10691071
}
@@ -1094,20 +1096,20 @@ namespace ts {
10941096
break;
10951097
}
10961098

1097-
const outputTime = host.getModifiedTime(output);
1098-
if (outputTime !== undefined && outputTime < oldestOutputFileTime) {
1099+
const outputTime = host.getModifiedTime(output) || missingFileModifiedTime;
1100+
if (outputTime < oldestOutputFileTime) {
10991101
oldestOutputFileTime = outputTime;
11001102
oldestOutputFileName = output;
11011103
}
11021104

11031105
// If an output is older than the newest input, we can stop checking
11041106
// Don't immediately return because we can still be upstream-blocked, which is a higher-priority status
1105-
if (outputTime !== undefined && outputTime < newestInputFileTime) {
1107+
if (outputTime < newestInputFileTime) {
11061108
isOutOfDateWithInputs = true;
11071109
break;
11081110
}
11091111

1110-
if (outputTime !== undefined && outputTime > newestOutputFileTime) {
1112+
if (outputTime > newestOutputFileTime) {
11111113
newestOutputFileTime = outputTime;
11121114
newestOutputFileName = output;
11131115
}
@@ -1122,10 +1124,8 @@ namespace ts {
11221124
newestDeclarationFileContentChangedTime = newer(unchangedTime, newestDeclarationFileContentChangedTime);
11231125
}
11241126
else {
1125-
const outputModifiedTime = host.getModifiedTime(output);
1126-
if (outputModifiedTime !== undefined) {
1127-
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
1128-
}
1127+
const outputModifiedTime = host.getModifiedTime(output) || missingFileModifiedTime;
1128+
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
11291129
}
11301130
}
11311131
}

src/tsserver/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ namespace ts.server {
676676
fs.stat(watchedFile.fileName, (err, stats) => {
677677
if (err) {
678678
if (err.code === "ENOENT") {
679-
if (watchedFile.mtime !== undefined && watchedFile.mtime.getTime() !== 0) {
679+
if (watchedFile.mtime.getTime() !== 0) {
680680
watchedFile.mtime = missingFileModifiedTime;
681681
watchedFile.callback(watchedFile.fileName, FileWatcherEventKind.Deleted);
682682
}

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,7 @@ declare namespace ts {
25812581
}
25822582
interface UpToDateHost {
25832583
fileExists(fileName: string): boolean;
2584-
getModifiedTime(fileName: string): Date;
2584+
getModifiedTime(fileName: string): Date | undefined;
25852585
getUnchangedTime?(fileName: string): Date | undefined;
25862586
getLastStatus?(fileName: string): UpToDateStatus | undefined;
25872587
setLastStatus?(fileName: string, status: UpToDateStatus): void;
@@ -2685,7 +2685,7 @@ declare namespace ts {
26852685
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
26862686
getEnvironmentVariable?(name: string): string | undefined;
26872687
createHash?(data: string): string;
2688-
getModifiedTime?(fileName: string): Date;
2688+
getModifiedTime?(fileName: string): Date | undefined;
26892689
setModifiedTime?(fileName: string, date: Date): void;
26902690
deleteFile?(fileName: string): void;
26912691
}
@@ -3022,7 +3022,7 @@ declare namespace ts {
30223022
getCurrentDirectory(): string;
30233023
getDirectories(path: string): string[];
30243024
readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
3025-
getModifiedTime?(path: string): Date;
3025+
getModifiedTime?(path: string): Date | undefined;
30263026
setModifiedTime?(path: string, time: Date): void;
30273027
deleteFile?(path: string): void;
30283028
/**

tests/baselines/reference/api/typescript.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,7 +2581,7 @@ declare namespace ts {
25812581
}
25822582
interface UpToDateHost {
25832583
fileExists(fileName: string): boolean;
2584-
getModifiedTime(fileName: string): Date;
2584+
getModifiedTime(fileName: string): Date | undefined;
25852585
getUnchangedTime?(fileName: string): Date | undefined;
25862586
getLastStatus?(fileName: string): UpToDateStatus | undefined;
25872587
setLastStatus?(fileName: string, status: UpToDateStatus): void;
@@ -2685,7 +2685,7 @@ declare namespace ts {
26852685
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string): ResolvedTypeReferenceDirective[];
26862686
getEnvironmentVariable?(name: string): string | undefined;
26872687
createHash?(data: string): string;
2688-
getModifiedTime?(fileName: string): Date;
2688+
getModifiedTime?(fileName: string): Date | undefined;
26892689
setModifiedTime?(fileName: string, date: Date): void;
26902690
deleteFile?(fileName: string): void;
26912691
}
@@ -3022,7 +3022,7 @@ declare namespace ts {
30223022
getCurrentDirectory(): string;
30233023
getDirectories(path: string): string[];
30243024
readDirectory(path: string, extensions?: ReadonlyArray<string>, exclude?: ReadonlyArray<string>, include?: ReadonlyArray<string>, depth?: number): string[];
3025-
getModifiedTime?(path: string): Date;
3025+
getModifiedTime?(path: string): Date | undefined;
30263026
setModifiedTime?(path: string, time: Date): void;
30273027
deleteFile?(path: string): void;
30283028
/**

0 commit comments

Comments
 (0)