fix: warn on EPERM for project directory just like EACCES (#16934)

This commit is contained in:
Scott Gunther
2021-06-22 10:41:32 -04:00
committed by GitHub
parent 56bcbb61e6
commit 03ab08d38f
3 changed files with 18 additions and 3 deletions

View File

@@ -167,7 +167,7 @@ Search [all issues](https://github.com/cypress-io/cypress/issues) for keywords f
If an issue already exists you should:
- Thank them for their contribution.
- Explain that this issue if a duplicate of another issue, linking to the relevant issue (`#1234`).
- Explain that this issue is a duplicate of another issue, linking to the relevant issue (`#1234`).
- Add the `type: duplicate` label to the issue.
- Close the issue.

View File

@@ -125,7 +125,7 @@ module.exports = {
log('cannot find file %s', file)
return this._err('CONFIG_FILE_NOT_FOUND', this.configFile(options), projectRoot)
}).catch({ code: 'EACCES' }, () => {
}).catch({ code: 'EACCES' }, { code: 'EPERM' }, () => {
// we cannot write due to folder permissions
return errors.warning('FOLDER_NOT_WRITABLE', projectRoot)
}).catch((err) => {

View File

@@ -806,7 +806,7 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
})
})
it('bubbles up Settings.read errors', function () {
it('bubbles up Settings.read EACCES error', function () {
const err = new Error()
err.code = 'EACCES'
@@ -820,6 +820,21 @@ This option will not have an effect in Some-other-name. Tests that rely on web s
expect(err.code).to.eq('EACCES')
})
})
it('bubbles up Settings.read EPERM error', function () {
const err = new Error()
err.code = 'EPERM'
sinon.stub(settings, 'read').rejects(err)
return this.project.getProjectId()
.then((id) => {
throw new Error('expected to fail, but did not')
}).catch((err) => {
expect(err.code).to.eq('EPERM')
})
})
})
context('#writeProjectId', () => {