fix: --config-file can now handle absolute paths. (#16746)

Co-authored-by: Guillaume Viguier guillaume.viguier-just@propulse-lab.com
This commit is contained in:
Kukhyeon Heo
2021-06-02 00:55:53 +09:00
committed by GitHub
parent 06be00fee4
commit e5276f8ace
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ const renameSupportFolder = (obj) => {
module.exports = {
_pathToFile (projectRoot, file) {
return path.join(projectRoot, file)
return path.isAbsolute(file) ? file : path.join(projectRoot, file)
},
_err (type, file, err) {
@@ -0,0 +1,22 @@
require('../../spec_helper')
const setting = require(`../../../lib/util/settings`)
describe('lib/util/settings', () => {
describe('pathToConfigFile', () => {
it('supports relative path', () => {
const path = setting.pathToConfigFile('/users/tony/cypress', {
configFile: 'e2e/config.json',
})
expect(path).to.equal('/users/tony/cypress/e2e/config.json')
})
it('supports absolute path', () => {
const path = setting.pathToConfigFile('/users/tony/cypress', {
configFile: '/users/pepper/cypress/e2e/cypress.config.json',
})
expect(path).to.equal('/users/pepper/cypress/e2e/cypress.config.json')
})
})
})