Little more diff cleanup

This commit is contained in:
Nathan Shively-Sanders
2022-05-25 10:44:24 -07:00
parent fdd44be514
commit ab673e8349
+18 -18
View File
@@ -282,11 +282,11 @@ interface Array<T> { length: number; [n: number]: T; }`
export const timeIncrements = 1000;
export class TestServerHost extends VirtualServerBaseHost implements server.ServerHost {
readonly screenClears: number[] = [];
private readonly output: string[] = [];
private time = timeIncrements;
private timeoutCallbacks = new Callbacks(this);
private immediateCallbacks = new Callbacks(this);
readonly screenClears: number[] = [];
private readonly environmentVariables?: ESMap<string, string>;
public require: ((initialPath: string, moduleName: string) => RequireResult) | undefined;
private readonly tscWatchFile?: string;
@@ -340,6 +340,16 @@ interface Array<T> { length: number; [n: number]: T; }`
this.reloadFS(fileOrFolderOrSymLinkList);
}
// Output is pretty
writeOutputIsTTY() {
return true;
}
override now() {
this.time += timeIncrements;
return new Date(this.time);
}
getTime() {
return this.time;
}
@@ -393,16 +403,6 @@ interface Array<T> { length: number; [n: number]: T; }`
}
}
// Output is pretty
writeOutputIsTTY() {
return true;
}
override now() {
this.time += timeIncrements;
return new Date(this.time);
}
renameFile(fileName: string, newFileName: string) {
const fullPath = getNormalizedAbsolutePath(fileName, this.currentDirectory);
const path = this.toPath(fullPath);
@@ -557,13 +557,6 @@ interface Array<T> { length: number; [n: number]: T; }`
assert.equal(callbacksCount, expected, `expected ${expected} timeout callbacks queued but found ${callbacksCount}.`);
}
runQueuedImmediateCallbacks(checkCount?: number) {
if (checkCount !== undefined) {
assert.equal(this.immediateCallbacks.count(), checkCount);
}
this.immediateCallbacks.invoke();
}
runQueuedTimeoutCallbacks(timeoutId?: number) {
try {
this.timeoutCallbacks.invoke(timeoutId);
@@ -576,6 +569,13 @@ interface Array<T> { length: number; [n: number]: T; }`
}
}
runQueuedImmediateCallbacks(checkCount?: number) {
if (checkCount !== undefined) {
assert.equal(this.immediateCallbacks.count(), checkCount);
}
this.immediateCallbacks.invoke();
}
setImmediate(callback: TimeOutCallback, ...args: any[]) {
return this.immediateCallbacks.register(callback, args);
}