mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-04 21:49:50 -06:00
See #19347 for full summary Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com> Co-authored-by: estrada9166 <estrada9166@hotmail.com> Co-authored-by: Alejandro Estrada <estrada9166@gmail.com> Co-authored-by: Jess <jess@jessicasachs.io>
37 lines
904 B
JavaScript
37 lines
904 B
JavaScript
const path = require('path')
|
|
const execa = require('execa')
|
|
const inspector = require('inspector')
|
|
const debug = require('debug')('cypress:scripts')
|
|
|
|
const args = process.argv.slice(2)
|
|
|
|
const pathToCli = path.resolve(__dirname, '..', 'cli', 'bin', 'cypress')
|
|
|
|
if (inspector.url()) {
|
|
process.CYPRESS_INTERNAL_DEV_DEBUG = `--inspect=${process.debugPort + 1}`
|
|
}
|
|
|
|
// always run the CLI in dev mode
|
|
// so it utilizes the development binary
|
|
// instead of the globally installed prebuilt one
|
|
args.push('--dev')
|
|
|
|
debug('starting the CLI in dev mode with args %o', {
|
|
command: pathToCli,
|
|
args,
|
|
})
|
|
|
|
const exit = ({ exitCode }) => {
|
|
if (typeof exitCode !== 'number') {
|
|
// eslint-disable-next-line no-console
|
|
console.error(`missing exit code from execa (received ${exitCode})`)
|
|
process.exit(1)
|
|
}
|
|
|
|
process.exit(exitCode)
|
|
}
|
|
|
|
execa(pathToCli, args, { stdio: 'inherit' })
|
|
.then(exit)
|
|
.catch(exit)
|