Skip to content

Commit e6a9505

Browse files
dcermakRyanZim
andauthored
Skip the ncp / error / dest-permission test if running as root (#899)
This test tries to create a directory where the current user does not have the permissions to do so and expects a failure. However, the root user is by design always allowed to do that (ignoring file permissions). So we must skip the test in these cases then. Fixes #898 Co-authored-by: Ryan Zimmerman <[email protected]>
1 parent fb6c0ca commit e6a9505

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/copy/__tests__/ncp/ncp-error-perm.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ describe('ncp / error / dest-permission', () => {
2121
const src = path.join(TEST_DIR, 'src')
2222
const dest = path.join(TEST_DIR, 'dest')
2323

24-
if (os.platform().indexOf('win') === 0) return
24+
// when we are root, then we will be able to create the subdirectory even if
25+
// we don't have the permissions to do so, so no point in running this test
26+
if (os.platform().indexOf('win') === 0 || os.userInfo().uid === 0) return
2527

2628
beforeEach(done => {
2729
fse.emptyDir(TEST_DIR, err => {

0 commit comments

Comments
 (0)