Skip to content
Snippets Groups Projects
Commit 66b6fe51 authored by Sourabh Desai's avatar Sourabh Desai
Browse files

fix access() implementation for in memory fs

parent a7edc4d2
No related branches found
No related tags found
No related merge requests found
......@@ -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> {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment