Skip to content

Commit 137c99b

Browse files
author
Andy
authored
Merge pull request microsoft#11974 from Microsoft/set_immediate
Make `cachingInServerLSHost` tests work with `runtests-browser`
2 parents 4371889 + de6751b commit 137c99b

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

src/harness/unittests/cachingInServerLSHost.ts

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,17 @@ namespace ts {
2222
newLine: "\r\n",
2323
useCaseSensitiveFileNames: false,
2424
write: noop,
25-
readFile: (path: string): string => {
26-
return path in fileMap ? fileMap[path].content : undefined;
27-
},
28-
writeFile: (_path: string, _data: string, _writeByteOrderMark?: boolean) => {
29-
return ts.notImplemented();
30-
},
31-
resolvePath: (_path: string): string => {
32-
return ts.notImplemented();
33-
},
34-
fileExists: (path: string): boolean => {
35-
return path in fileMap;
36-
},
37-
directoryExists: (path: string): boolean => {
38-
return existingDirectories[path] || false;
39-
},
25+
readFile: path => path in fileMap ? fileMap[path].content : undefined,
26+
writeFile: notImplemented,
27+
resolvePath: notImplemented,
28+
fileExists: path => path in fileMap,
29+
directoryExists: path => existingDirectories[path] || false,
4030
createDirectory: noop,
41-
getExecutingFilePath: (): string => {
42-
return "";
43-
},
44-
getCurrentDirectory: (): string => {
45-
return "";
46-
},
31+
getExecutingFilePath: () => "",
32+
getCurrentDirectory: () => "",
4733
getDirectories: () => [],
4834
getEnvironmentVariable: () => "",
49-
readDirectory: (_path: string, _extension?: string[], _exclude?: string[], _include?: string[]): string[] => {
50-
return ts.notImplemented();
51-
},
35+
readDirectory: notImplemented,
5236
exit: noop,
5337
watchFile: () => ({
5438
close: noop
@@ -58,8 +42,8 @@ namespace ts {
5842
}),
5943
setTimeout,
6044
clearTimeout,
61-
setImmediate,
62-
clearImmediate
45+
setImmediate: typeof setImmediate !== "undefined" ? setImmediate : action => setTimeout(action, 0),
46+
clearImmediate: typeof clearImmediate !== "undefined" ? clearImmediate : clearTimeout
6347
};
6448
}
6549

0 commit comments

Comments
 (0)