`fs.stat` function for symlink pointing to directory in Windows

Clash Royale CLAN TAG#URR8PPP
`fs.stat` function for symlink pointing to directory in Windows
In my windows environment (x64), fs.stat function for symlink pointing to directory brings an error.
fs.stat
symlink
On the other hand, in appveyor (ia32), fs.stat function for symlink pointing to directory works well.
fs.stat
symlink
This is why? and which behavior is correct?
A part of my test code is
it('Test 001 : fs.stat for symlink', function ()
var target = path.resolve(workDir, 'sample1');
console.log('target :' + target);
fs.mkdirSync(target); // create directory
var link = path.resolve(workDir, 'link1');
console.log('link :' + link);
fs.symlinkSync(target, link); // create symlink to directory
expect(function()
var stat = fs.statSync(link); // checking symlink stat
console.log(stat);
).not.toThrow();
);
Please see https://github.com/knight9999/WindowsSymbolicLinkCheck for all codes.
The result of my local environment is
Failures:
1) win symlink tests Test 001 : fs.stat for symlink
Message:
Expected function not to throw, but it threw Error: EPERM: operation not permitted, stat 'C:UsersknaitoAppDataLocalTempappveyor-tests-winSymlinkTests-VcfaRolink1'.
Stack:
Error: Expected function not to throw, but it threw Error: EPERM: operation not permitted, stat 'C:UsersknaitoAppDataLocalTempappveyor-tests-winSymlinkTests-VcfaRolink1'.
at <Jasmine>
at UserContext.<anonymous> (C:UsersknaitoDocumentsworkcordova-developWindowsSymbolicLinkCheckspecwinSymlink.spec.js:24:12)
at <Jasmine>
1 spec, 1 failure
The result of appveyor is
Started
target :C:UsersappveyorAppDataLocalTemp1appveyor-tests-winSymlinkTests-NsaPyJsample1
link :C:UsersappveyorAppDataLocalTemp1appveyor-tests-winSymlinkTests-NsaPyJlink1
Stats
dev: 3567992900,
mode: 16822,
nlink: 1,
uid: 0,
gid: 0,
rdev: 0,
blksize: undefined,
ino: 844424934502125,
size: 0,
blocks: undefined,
atimeMs: 1537164694047.7703,
mtimeMs: 1537164694047.7703,
ctimeMs: 1537164694047.7703,
birthtimeMs: 1537164694047.7703,
atime: 2018-09-17T06:11:34.048Z,
mtime: 2018-09-17T06:11:34.048Z,
ctime: 2018-09-17T06:11:34.048Z,
birthtime: 2018-09-17T06:11:34.048Z
.
Please see https://ci.appveyor.com/project/knight9999/windowssymboliclinkcheck .
Note:
I know that the symlinkd or junction is appropriate for directory in windows.
However fs.copy for a junction pointing to directory creates new symlink (neither symlinkd nor junction) automatically.
symlinkd
junction
fs.copy
junction
symlink
symlinkd
junction
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.