mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-30 03:51:21 -05:00
fe785749e8
cleanup
28 lines
750 B
JavaScript
28 lines
750 B
JavaScript
const path = require('path')
|
|
|
|
// helper for resolving to the current working directory
|
|
// since electron does not play nice with process.cwd()
|
|
// this function should always return path.dirname('package.json')
|
|
const appPath = (function () {
|
|
// if lib is our basename then we haven't
|
|
// been concatted or moved and we need to
|
|
// walk up one folder to access our app path
|
|
if (path.basename(__dirname) === 'lib') {
|
|
return path.join(__dirname, '..')
|
|
}
|
|
|
|
// we are already in the app path
|
|
return __dirname
|
|
})()
|
|
|
|
// after we figure out our appPath
|
|
// if the process.cwd() isnt set to that
|
|
// then change it
|
|
if (process.cwd() !== appPath) {
|
|
process.chdir(appPath)
|
|
}
|
|
|
|
module.exports = (...args) => {
|
|
return path.join(appPath, ...args)
|
|
}
|