(parsedAnswers: ParsedAnswers)
| 567 | |
| 568 | /* c8 ignore start */ |
| 569 | export async function createWDIOScript(parsedAnswers: ParsedAnswers) { |
| 570 | const rootDir = await getProjectRoot(parsedAnswers) |
| 571 | const pathToWdioConfig = `./${path.join('.', parsedAnswers.wdioConfigPath.replace(rootDir, ''))}` |
| 572 | |
| 573 | const wdioScripts = { |
| 574 | 'wdio': `wdio run ${pathToWdioConfig}`, |
| 575 | } |
| 576 | |
| 577 | const serenityScripts = { |
| 578 | 'serenity': 'failsafe serenity:clean wdio serenity:report', |
| 579 | 'serenity:clean': 'rimraf target', |
| 580 | 'wdio': `wdio run ${pathToWdioConfig}`, |
| 581 | 'serenity:report': 'serenity-bdd run', |
| 582 | } |
| 583 | |
| 584 | const scripts = parsedAnswers.serenityAdapter ? serenityScripts : wdioScripts |
| 585 | |
| 586 | for (const [script, command] of Object.entries(scripts)) { |
| 587 | |
| 588 | const args = ['pkg', 'set', `scripts.${script}=${command}`] |
| 589 | |
| 590 | try { |
| 591 | console.log(`Adding ${chalk.bold(`"${script}"`)} script to package.json`) |
| 592 | await runProgram(NPM_COMMAND, args, { cwd: parsedAnswers.projectRootDir }) |
| 593 | } catch (err) { |
| 594 | const [preArgs, scriptPath] = args.join(' ').split('=') |
| 595 | console.error( |
| 596 | `⚠️ Couldn't add script to package.json: "${(err as Error).message}", you can add it manually ` + |
| 597 | `by running:\n\n\t${NPM_COMMAND} ${preArgs}="${scriptPath}"` |
| 598 | ) |
| 599 | return false |
| 600 | } |
| 601 | } |
| 602 | console.log(chalk.green(chalk.bold('✔ Success!'))) |
| 603 | return true |
| 604 | } |
| 605 | /* c8 ignore stop */ |
| 606 | |
| 607 | export async function runAppiumInstaller(parsedAnswers: ParsedAnswers) { |
no test coverage detected
searching dependent graphs…