mirror of
https://github.com/Effect-TS/effect.git
synced 2026-12-03 03:25:40 +08:00
fix(platform-node): use native realpath on Windows (#9489)
Co-authored-by: Effect Bot <tech-ops@effectful.co>
This commit is contained in:
co-authored by
Effect Bot
parent
02d7fc5830
commit
41cf29b5d8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user