Commit 1555ced
test, win: fix up symlink tests
On Windows, creating a symlink requires admin privileges.
There were two tests which created symlinks which were failing when run
as non-admin.
test-fs-symlink.js already had a check for privileges on Windows
but it had a couple issues:
1. It assumed that whoami was the one that came with windows.
However, whoami also ships with Win32 Unix utility ports
like the distribution with git, which can cause this to get check
tripped up.
2. On failure, the check would just return from the callback instead of
exiting
3. whoami was executed asynchronously so the test would run regardless
of privilege state.
test-fs-options-immutable had no check.
As part of this change, I refactored the privilege checking to
a function in common, and changed both above tests to use the
refactored function.
Also documented this function in test\README.md
PR-URL: #10477
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>1 parent 60f27f9 commit 1555cedCopy full SHA for 1555ced
File tree
Expand file treeCollapse file tree
4 files changed
+40
-11
lines changedOpen diff view settings
Filter options
- test
- parallel
Expand file treeCollapse file tree
4 files changed
+40
-11
lines changedOpen diff view settings
Collapse file
+7Lines changed: 7 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
163 | 163 | |
164 | 164 | |
165 | 165 | |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
166 | 173 | |
167 | 174 | |
168 | 175 | |
|
Collapse file
+29Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
| 11 | + |
11 | 12 | |
12 | 13 | |
13 | 14 | |
| ||
438 | 439 | |
439 | 440 | |
440 | 441 | |
| 442 | + |
| 443 | + |
| 444 | + |
| 445 | + |
| 446 | + |
| 447 | + |
| 448 | + |
| 449 | + |
| 450 | + |
| 451 | + |
| 452 | + |
| 453 | + |
| 454 | + |
| 455 | + |
| 456 | + |
| 457 | + |
| 458 | + |
| 459 | + |
| 460 | + |
| 461 | + |
| 462 | + |
| 463 | + |
| 464 | + |
| 465 | + |
| 466 | + |
| 467 | + |
| 468 | + |
| 469 | + |
441 | 470 | |
442 | 471 | |
443 | 472 | |
|
Collapse file
test/parallel/test-fs-options-immutable.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-options-immutable.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | | - |
| 32 | + |
33 | 33 | |
34 | 34 | |
35 | 35 | |
|
Collapse file
test/parallel/test-fs-symlink.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-symlink.js+3-10Lines changed: 3 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3 | 3 | |
4 | 4 | |
5 | 5 | |
6 | | - |
7 | 6 | |
8 | 7 | |
9 | 8 | |
10 | 9 | |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
| 10 | + |
| 11 | + |
| 12 | + |
20 | 13 | |
21 | 14 | |
22 | 15 | |
|
0 commit comments