(root: string)
| 36 | } |
| 37 | |
| 38 | function remappedFs(root: string) { |
| 39 | return Layer.effect( |
| 40 | FSUtil.Service, |
| 41 | Effect.gen(function* () { |
| 42 | const fs = yield* FSUtil.Service |
| 43 | return FSUtil.Service.of({ |
| 44 | ...fs, |
| 45 | isDir: (file) => fs.isDir(remap(root, file)), |
| 46 | readJson: (file) => fs.readJson(remap(root, file)), |
| 47 | writeWithDirs: (file, content, mode) => fs.writeWithDirs(remap(root, file), content, mode), |
| 48 | readFileString: (file) => fs.readFileString(remap(root, file)), |
| 49 | remove: (file) => fs.remove(remap(root, file)), |
| 50 | glob: (pattern, options) => |
| 51 | fs.glob(pattern, options?.cwd ? { ...options, cwd: remap(root, options.cwd) } : options), |
| 52 | }) |
| 53 | }), |
| 54 | ).pipe(Layer.provide(LayerNode.compile(FSUtil.node))) |
| 55 | } |
| 56 | |
| 57 | // Layer.fresh forces a new Storage instance — without it, Effect's in-test layer cache |
| 58 | // returns the outer testEffect's Storage (which uses the real FSUtil), not a new |
no test coverage detected