mirror of
https://github.com/cypress-io/cypress.git
synced 2025-12-31 03:29:48 -06:00
* cli: add otherSpecs for varargs [wip] * scripts: pass command-line args through to debugged command * cli: parse space-delimited specs * cli: undo unneeded * cli: cleaned up parseVariableOpts, added warning * cli: cleanup * cli: add tests * cli: glorious whitespace * cli: a more robust test * cli: better snapshot * server: strip single-quotes around --spec arg #2298
37 lines
747 B
JavaScript
37 lines
747 B
JavaScript
const cp = require('child_process')
|
|
const chalk = require('chalk')
|
|
const pkg = require('../package.json')
|
|
|
|
const INSPECT_PORT = 5566
|
|
|
|
const script = process.argv[2]
|
|
|
|
if (!script) {
|
|
throw new Error('Missing script argument')
|
|
}
|
|
|
|
const pkgScript = pkg.scripts[script]
|
|
|
|
if (!pkgScript) {
|
|
throw new Error(`package.json scripts not found for script: ${script}`)
|
|
}
|
|
|
|
const [cmd, ...args] = pkgScript.split(' ')
|
|
const userArgs = process.argv.slice(3)
|
|
|
|
args.unshift(`--inspect-brk=${INSPECT_PORT}`)
|
|
args.push(...userArgs)
|
|
|
|
const log = (k, v) => {
|
|
// eslint-disable-next-line
|
|
console.log(chalk.yellow(k), chalk.cyan(v))
|
|
}
|
|
|
|
log('Node:', process.version)
|
|
log('Script:', script)
|
|
log('Spawning:', pkgScript)
|
|
|
|
cp.spawn(cmd, args, {
|
|
stdio: 'inherit',
|
|
})
|