Files
cypress/scripts/test-debug-package.js
Brian Mann 2333d04a54 secure cookie error crash (#2685)
- fixes #1264 
- fixes #1321 
- fixes #1799  
- fixes #2689
- fixes #2688
- fixes #2687 	
- fixes #2686
2018-11-01 12:34:37 -04:00

31 lines
768 B
JavaScript

const cp = require('child_process')
const path = require('path')
const chalk = require('chalk')
const finder = require('find-package-json')
const DEFAULT_SCRIPT = 'npm run test -- --inspect-brk=5566'
const file = process.argv[2]
// walks up from the file until it finds the first
// package.json in a parent folder
const { value: pkg, filename } = finder(file).next()
const script = pkg.scripts['test-debug'] || DEFAULT_SCRIPT
const [cmd, ...args] = script.split(' ')
const log = (k, v) => {
// eslint-disable-next-line
console.log(chalk.yellow(k), chalk.cyan(v))
}
log('Node version:', process.version)
log('Debug script:', script)
log('Debugging test file:', file)
cp.spawn(cmd, args.concat(file), {
cwd: path.dirname(filename),
stdio: 'inherit',
})