Files
cypress/scripts/start.js
Brian Mann e2458ba9db root: refactor run-integration to common scripts -> run-cypress-tests, accept options, use xvfb-maybe, cleanup circle.yml
- this enables us to use a common script for running cypress tests
within the monorepo itself
- useful for the driver, desktop-gui, and the reporter
2017-09-16 16:38:00 -04:00

25 lines
902 B
JavaScript

const findIndex = require('lodash/findIndex')
const path = require('path')
// if passing the --project or --run-project arg, normalize its value so
// that it's relative to the root and not to packages/server
const projectArgIndex = findIndex(process.argv, (arg) => {
return arg.includes('--project') || arg.includes('--run-project')
})
if (projectArgIndex > -1) {
if (process.argv[projectArgIndex].includes('=')) {
// --project=../foo
const [arg, projectPath] = process.argv[projectArgIndex].split('=')
process.argv[projectArgIndex] = `${arg}=${path.resolve(projectPath)}`
} else {
// --project ../foo
const projectPath = process.argv[projectArgIndex + 1]
// make sure it's the path and not another argument flag
if (projectPath.substring(0, 2) !== '--') {
process.argv[projectArgIndex + 1] = path.resolve(projectPath)
}
}
}
require('@packages/server')