mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-07 06:59:49 -06:00
- 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
25 lines
902 B
JavaScript
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')
|