MCPcopy Create free account
hub / github.com/cypress-io/github-action / runTestsUsingCommandLine

Function runTestsUsingCommandLine

index.js:593–727  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

591 * Forms entire command line like "npx cypress run ..."
592 */
593const runTestsUsingCommandLine = async () => {
594 debug('Running Cypress tests using CLI command')
595 const quoteArgument = isWindows() ? quoteWindowsArgument : I
596
597 const commandPrefix = core.getInput('command-prefix')
598 if (!commandPrefix) {
599 throw new Error('Expected command prefix')
600 }
601
602 const record = getInputBool('record')
603 const parallel = getInputBool('parallel')
604 const component = getInputBool('component')
605 const headed = getInputBool('headed')
606
607 // TODO using yarn to run cypress when yarn is used for install
608 // split potentially long command?
609
610 let cmd = []
611 // we need to split the command prefix into individual arguments
612 // otherwise they are passed all as a single string
613 const parts = commandPrefix.split(' ')
614 cmd = cmd.concat(parts)
615 debug(`with concatenated command prefix: ${cmd.join(' ')}`)
616
617 // push each CLI argument separately
618 cmd.push('cypress')
619 cmd.push('run')
620
621 if (component) {
622 cmd.push('--component')
623 }
624 if (headed) {
625 cmd.push('--headed')
626 }
627 if (record) {
628 cmd.push('--record')
629 }
630 if (parallel) {
631 cmd.push('--parallel')
632 }
633 const group = core.getInput('group')
634 if (group) {
635 cmd.push('--group')
636 cmd.push(quoteArgument(group))
637 }
638 const tag = core.getInput('tag')
639 if (tag) {
640 cmd.push('--tag')
641 cmd.push(quoteArgument(tag))
642 }
643 const configInput = core.getInput('config')
644 if (configInput) {
645 cmd.push('--config')
646 cmd.push(quoteArgument(configInput))
647 }
648 const spec = getSpecsList()
649 if (spec) {
650 cmd.push('--spec')

Callers 1

runTestsFunction · 0.85

Calls 4

isWindowsFunction · 0.85
getInputBoolFunction · 0.85
getSpecsListFunction · 0.85
getCiBuildIdFunction · 0.85

Tested by

no test coverage detected