Skip to content

Commit

Permalink
test: avoid read check when running as root (#14884)
Browse files Browse the repository at this point in the history
  • Loading branch information
summer-boythink authored Nov 21, 2023
1 parent 41e437f commit 1d9516c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/vite/src/node/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,14 @@ describe('isFileReadable', () => {
fs.chmodSync(testFile, '400')
expect(isFileReadable(testFile)).toBe(true)
})
test('file without read permission', async () => {
fs.chmodSync(testFile, '044')
expect(isFileReadable(testFile)).toBe(false)
fs.chmodSync(testFile, '644')
})
test.runIf(process.getuid && process.getuid() !== 0)(
'file without read permission',
async () => {
fs.chmodSync(testFile, '044')
expect(isFileReadable(testFile)).toBe(false)
fs.chmodSync(testFile, '644')
},
)
}
})

Expand Down

0 comments on commit 1d9516c

Please sign in to comment.