Skip to content

Commit 1d9516c

Browse files
test: avoid read check when running as root (#14884)
1 parent 41e437f commit 1d9516c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/vite/src/node/__tests__/utils.spec.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,14 @@ describe('isFileReadable', () => {
296296
fs.chmodSync(testFile, '400')
297297
expect(isFileReadable(testFile)).toBe(true)
298298
})
299-
test('file without read permission', async () => {
300-
fs.chmodSync(testFile, '044')
301-
expect(isFileReadable(testFile)).toBe(false)
302-
fs.chmodSync(testFile, '644')
303-
})
299+
test.runIf(process.getuid && process.getuid() !== 0)(
300+
'file without read permission',
301+
async () => {
302+
fs.chmodSync(testFile, '044')
303+
expect(isFileReadable(testFile)).toBe(false)
304+
fs.chmodSync(testFile, '644')
305+
},
306+
)
304307
}
305308
})
306309

0 commit comments

Comments
 (0)