* 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.
()
| 2563 | * with the reason in their name, rather than passing without running. |
| 2564 | */ |
| 2565 | function canCreateFileSymlink(): boolean { |
| 2566 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'cg-symlink-probe-')); |
| 2567 | try { |
| 2568 | fs.writeFileSync(path.join(dir, 'target'), ''); |
| 2569 | fs.symlinkSync(path.join(dir, 'target'), path.join(dir, 'link'), 'file'); |
| 2570 | return true; |
| 2571 | } catch { |
| 2572 | return false; |
| 2573 | } finally { |
| 2574 | fs.rmSync(dir, { recursive: true, force: true }); |
| 2575 | } |
| 2576 | } |
| 2577 | const FILE_SYMLINKS = canCreateFileSymlink(); |
| 2578 | const NO_FILE_SYMLINKS = ' — skipped: creating a file symlink needs Developer Mode or admin rights on Windows'; |
| 2579 |
no test coverage detected