Skip to content

Commit b5737fc

Browse files
committed
Refactor tests so its easy to edit and reason about them
1 parent f7ea0ba commit b5737fc

File tree

3 files changed

+802
-461
lines changed

3 files changed

+802
-461
lines changed

src/harness/virtualFileSystemWithWatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ interface Array<T> {}`
196196
}
197197
}
198198

199-
export function checkWatchedFiles(host: TestServerHost, expectedFiles: string[]) {
200-
checkMapKeys("watchedFiles", host.watchedFiles, expectedFiles);
199+
export function checkWatchedFiles(host: TestServerHost, expectedFiles: string[], additionalInfo?: string) {
200+
checkMapKeys(`watchedFiles:: ${additionalInfo || ""}::`, host.watchedFiles, expectedFiles);
201201
}
202202

203203
export function checkWatchedFilesDetailed(host: TestServerHost, expectedFiles: ReadonlyMap<number>): void;

src/testRunner/unittests/tsserver/helpers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ namespace ts.projectSystem {
488488
checkArray("Open files", arrayFrom(projectService.openFiles.keys(), path => projectService.getScriptInfoForPath(path as Path)!.fileName), expectedFiles.map(file => file.path));
489489
}
490490

491-
export function checkScriptInfos(projectService: server.ProjectService, expectedFiles: ReadonlyArray<string>) {
492-
checkArray("ScriptInfos files", arrayFrom(projectService.filenameToScriptInfo.values(), info => info.fileName), expectedFiles);
491+
export function checkScriptInfos(projectService: server.ProjectService, expectedFiles: ReadonlyArray<string>, additionInfo?: string) {
492+
checkArray(`ScriptInfos files: ${additionInfo || ""}`, arrayFrom(projectService.filenameToScriptInfo.values(), info => info.fileName), expectedFiles);
493493
}
494494

495495
export function protocolLocationFromSubstring(str: string, substring: string): protocol.Location {

0 commit comments

Comments
 (0)