mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-02 20:50:01 -06:00
- fixes #1264 - fixes #1321 - fixes #1799 - fixes #2689 - fixes #2688 - fixes #2687 - fixes #2686
35 lines
685 B
JavaScript
35 lines
685 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(' ')
|
|
|
|
args.unshift(`--inspect-brk=${INSPECT_PORT}`)
|
|
|
|
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',
|
|
})
|