Package: effect
Module: FileSystem
Creates a Layer that provides a no-op FileSystem implementation for testing.
Details
This is a convenience function that wraps makeNoop in a Layer, making it easy
to provide the test filesystem to your Effect programs.
Example (Providing a no-op FileSystem layer)
import { Effect, FileSystem } from "effect"
// Create a test layer with specific behaviors
const testLayer = FileSystem.layerNoop({
readFileString: (path) => Effect.succeed("mocked content"),
exists: () => Effect.succeed(true)
})
const program = Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
const content = yield* fs.readFileString("any-file.txt")
return content
})
// Provide the test layer
const testProgram = Effect.provide(program, testLayer)
Signature
declare const layerNoop: (fileSystem: Partial<FileSystem>) => Layer.Layer<FileSystem>
Since v4.0.0