* Whether this machine can create a file symlink. On Windows that needs * Developer Mode or admin rights; where it can't, the link tests are skipped, * with the reason in their name, rather than passing without running.
()
| 2396 | * with the reason in their name, rather than passing without running. |
| 2397 | */ |
| 2398 | function canCreateFileSymlink(): boolean { |
| 2399 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-')); |
| 2400 | try { |
| 2401 | fs.writeFileSync(path.join(dir, 'target'), ''); |
| 2402 | fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file'); |
| 2403 | return true; |
| 2404 | } catch { |
| 2405 | return false; |
| 2406 | } finally { |
| 2407 | fs.rmSync(dir, { recursive: true, force: true }); |
| 2408 | } |
| 2409 | } |
| 2410 | const FILE_SYMLINKS = canCreateFileSymlink(); |
| 2411 | const NO_FILE_SYMLINKS = ' — skipped: creating a file symlink needs Developer Mode or admin rights on Windows'; |
| 2412 |
no test coverage detected