fix(platform-node): use native realpath on Windows (#9489)

Co-authored-by: Effect Bot <tech-ops@effectful.co>
This commit is contained in:
Juan Cruz Changazo
2026-10-18 22:45:41 +13:00
committed by GitHub
co-authored by Effect Bot
parent 02d7fc5830
commit 41cf29b5d8
3 changed files with 21 additions and 2 deletions
@@ -8,7 +8,8 @@ import * as FileSystem from "effect/FileSystem"
import * as Option from "effect/Option"
import * as Stream from "effect/Stream"
import * as TestClock from "effect/testing/TestClock"
import type * as NFS from "node:fs"
import * as NFS from "node:fs"
import * as Path from "node:path"
import { afterEach, beforeEach, vi } from "vitest"
import { testLayer } from "../../../effect/test/FileSystem.test-utils.ts"
@@ -48,6 +49,19 @@ const startWatch = <E, R>(
describe("FileSystem", { concurrent: false }, () => {
testLayer(NodeFileSystem.layer, { noFollow: process.platform !== "win32" })
it.effect("realPath resolves a directory alias to its physical target", () =>
Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
const root = yield* fs.realPath(yield* fs.makeTempDirectoryScoped())
const target = Path.join(root, "target")
const alias = Path.join(root, "alias")
yield* fs.makeDirectory(target)
NFS.symlinkSync(target, alias, process.platform === "win32" ? "junction" : "dir")
assert.strictEqual(yield* fs.realPath(alias), target)
}).pipe(
Effect.provide(NodeFileSystem.layer)
))
it.effect("writeAll accepts an empty buffer", () =>
Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem