From c0a600786e32fa5e61ca40ef184772241446e33d Mon Sep 17 00:00:00 2001 From: futsuuu <105504350+futsuuu@users.noreply.github.com> Date: Tue, 14 May 2024 22:06:21 +0900 Subject: fix: Add missing `"junction"` type for `SymlinkOptions.types` (#23756) Junction symlink support is added in #22762, but `SymlinkOptions` and its documents are not updated. --- tests/unit/symlink_test.ts | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests') diff --git a/tests/unit/symlink_test.ts b/tests/unit/symlink_test.ts index 310c36930..0ee4a36fd 100644 --- a/tests/unit/symlink_test.ts +++ b/tests/unit/symlink_test.ts @@ -39,6 +39,24 @@ Deno.test( }, ); +Deno.test( + { + ignore: Deno.build.os !== "windows", + permissions: { read: true, write: true }, + }, + function symlinkSyncJunction() { + const testDir = Deno.makeTempDirSync(); + const oldname = testDir + "/oldname"; + const newname = testDir + "/newname"; + Deno.mkdirSync(oldname); + Deno.symlinkSync(oldname, newname, { type: "junction" }); + const newNameInfoLStat = Deno.lstatSync(newname); + const newNameInfoStat = Deno.statSync(newname); + assert(newNameInfoLStat.isSymlink); + assert(newNameInfoStat.isDirectory); + }, +); + Deno.test( { permissions: { read: false, write: false } }, function symlinkSyncPerm() { @@ -96,6 +114,24 @@ Deno.test( }, ); +Deno.test( + { + ignore: Deno.build.os !== "windows", + permissions: { read: true, write: true }, + }, + async function symlinkJunction() { + const testDir = Deno.makeTempDirSync(); + const oldname = testDir + "/oldname"; + const newname = testDir + "/newname"; + Deno.mkdirSync(oldname); + await Deno.symlink(oldname, newname, { type: "junction" }); + const newNameInfoLStat = Deno.lstatSync(newname); + const newNameInfoStat = Deno.statSync(newname); + assert(newNameInfoLStat.isSymlink, "NOT SYMLINK"); + assert(newNameInfoStat.isDirectory, "NOT DIRECTORY"); + }, +); + Deno.test( { permissions: { read: true, write: true } }, async function symlinkAlreadyExist() { -- cgit v1.2.3