refactor(compiler-cli): return the `FileSystem` from `initMockFileSystem()` (#39617)
It is common to want to use the file system once it is initialized, so it makes sense for this function to return it. PR Close #39617
This commit is contained in:
parent
9e53c6ee40
commit
7b6ea973f6
|
@ -66,10 +66,11 @@ runInEachFileSystem.unix = (callback: (os: string) => void) =>
|
||||||
runInEachFileSystem.windows = (callback: (os: string) => void) =>
|
runInEachFileSystem.windows = (callback: (os: string) => void) =>
|
||||||
runInFileSystem(FS_WINDOWS, callback, true);
|
runInFileSystem(FS_WINDOWS, callback, true);
|
||||||
|
|
||||||
export function initMockFileSystem(os: string, cwd?: AbsoluteFsPath): void {
|
export function initMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem {
|
||||||
const fs = createMockFileSystem(os, cwd);
|
const fs = createMockFileSystem(os, cwd);
|
||||||
setFileSystem(fs);
|
setFileSystem(fs);
|
||||||
monkeyPatchTypeScript(os, fs);
|
monkeyPatchTypeScript(os, fs);
|
||||||
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem {
|
function createMockFileSystem(os: string, cwd?: AbsoluteFsPath): MockFileSystem {
|
||||||
|
|
Loading…
Reference in New Issue