| 823 | }); |
| 824 | |
| 825 | class FailingWriteFs { |
| 826 | constructor( |
| 827 | private readonly inner: InMemoryFs, |
| 828 | private readonly failPath: string |
| 829 | ) {} |
| 830 | |
| 831 | async readFile(path: string) { |
| 832 | return this.inner.readFile(path); |
| 833 | } |
| 834 | |
| 835 | async readFileBytes(path: string) { |
| 836 | return this.inner.readFileBytes(path); |
| 837 | } |
| 838 | |
| 839 | async writeFile(path: string, content: string) { |
| 840 | if (path === this.failPath) { |
| 841 | throw new Error(`simulated write failure: ${path}`); |
| 842 | } |
| 843 | return this.inner.writeFile(path, content); |
| 844 | } |
| 845 | |
| 846 | async writeFileBytes(path: string, content: Uint8Array) { |
| 847 | if (path === this.failPath) { |
| 848 | throw new Error(`simulated write failure: ${path}`); |
| 849 | } |
| 850 | return this.inner.writeFileBytes(path, content); |
| 851 | } |
| 852 | |
| 853 | async appendFile(path: string, content: string | Uint8Array) { |
| 854 | return this.inner.appendFile(path, content); |
| 855 | } |
| 856 | |
| 857 | async exists(path: string) { |
| 858 | return this.inner.exists(path); |
| 859 | } |
| 860 | |
| 861 | async stat(path: string) { |
| 862 | return this.inner.stat(path); |
| 863 | } |
| 864 | |
| 865 | async lstat(path: string) { |
| 866 | return this.inner.lstat(path); |
| 867 | } |
| 868 | |
| 869 | async mkdir(path: string, options?: { recursive?: boolean }) { |
| 870 | return this.inner.mkdir(path, options); |
| 871 | } |
| 872 | |
| 873 | async readdir(path: string) { |
| 874 | return this.inner.readdir(path); |
| 875 | } |
| 876 | |
| 877 | async readdirWithFileTypes(path: string) { |
| 878 | return this.inner.readdirWithFileTypes(path); |
| 879 | } |
| 880 | |
| 881 | async rm(path: string, options?: { recursive?: boolean; force?: boolean }) { |
| 882 | return this.inner.rm(path, options); |
nothing calls this directly
no outgoing calls
no test coverage detected