diff --git a/packages/core/src/storage/FileSystem.ts b/packages/core/src/storage/FileSystem.ts index 9ac5e15ec1146e4f56821702e32341e4556375ca..35a95a897503f49834788ab67026630fad52f576 100644 --- a/packages/core/src/storage/FileSystem.ts +++ b/packages/core/src/storage/FileSystem.ts @@ -9,7 +9,7 @@ import _ from "lodash"; export interface GenericFileSystem { writeFile(path: string, content: string, options?: any): Promise<void>; readFile(path: string, options?: any): Promise<string>; - access(path: string): Promise<boolean>; + access(path: string): Promise<void>; mkdir(path: string, options?: any): Promise<void>; } @@ -35,8 +35,10 @@ export class InMemoryFileSystem implements GenericFileSystem { return _.cloneDeep(this.files[path]); } - async access(path: string): Promise<boolean> { - return path in this.files; + async access(path: string): Promise<void> { + if (!(path in this.files)) { + throw new Error(`File ${path} does not exist`); + } } async mkdir(path: string, options?: any): Promise<void> { diff --git a/packages/core/src/tests/InMemoryFileSystem.test.ts b/packages/core/src/tests/GenericFileSystem.test.ts similarity index 100% rename from packages/core/src/tests/InMemoryFileSystem.test.ts rename to packages/core/src/tests/GenericFileSystem.test.ts