(argv: any)
| 50 | }; |
| 51 | |
| 52 | export function configure(argv: any): Config { |
| 53 | const program = new Command(); |
| 54 | program |
| 55 | .name('angular-playground') |
| 56 | .option('-C, --config <path>', 'Configuration file', './.angular-playground/angular-playground.json') |
| 57 | .option('-S, --src <path>', 'Specify component source directories (comma separated list)', (v) => splitCommaSeparatedList(v, ['./src/'])) |
| 58 | |
| 59 | // Settings for prebuild |
| 60 | .option('--defined-sandboxes-path <path>', 'Defined sandboxes path (file path for CLI to write out sandboxed scenarios)', './.angular-playground') |
| 61 | |
| 62 | // Build options |
| 63 | .option('--no-watch', 'Disable sandboxes watch', false) |
| 64 | .option('--no-serve', 'Disable cli serve', false) |
| 65 | .option('--no-chunk', 'Don\'t chunk sandbox files individually', false) |
| 66 | .option('--build', 'Build your sandboxes for production with service workers disabled.', false) |
| 67 | .option('--build-with-service-worker', 'Build your sandboxes with service workers enabled. Requires @angular/service-worker', false) |
| 68 | .option('--base-href <href>', 'Specify a base-href for @angular/cli build', '/') |
| 69 | |
| 70 | // Sandbox verification |
| 71 | .option('--check-errors', 'Check for errors in all scenarios in all sandboxes', false) |
| 72 | .option('--random-scenario', 'Pick a random scenario from each sandbox to check for errors', false) |
| 73 | .option('--timeout <n>', 'Number of attempts for each sandbox', '90') |
| 74 | .option('--report-type <type>', 'Type of report to generate', REPORT_TYPE.LOG) |
| 75 | .option('--report-path <path>', 'Path of report to generate', '') |
| 76 | |
| 77 | // Snapshot tests |
| 78 | .option('--check-visual-regressions', 'Run visual regression tests', false) |
| 79 | .option('--snapshot-directory <dir>', 'Directory to store snapshots in', 'src/__images_snapshots__') |
| 80 | .option('--diff-directory <dir>', 'Directory to put diffs in', 'src/__diff_output__') |
| 81 | .option('--update-snapshots', 'Update stored snapshots', false) |
| 82 | .option('--delete-snapshots', 'Delete stored snapshots', false) |
| 83 | .option('--visual-regression-mock-date <dateInMs>', 'Date to set in puppeteer (in ms from epoch) for visual regression tests.', `${Date.now()}`) |
| 84 | .option('--visual-regression-sleep-duration <n>', 'Milliseconds to wait for sandbox scenario to load before capturing screenshot.', '100') |
| 85 | |
| 86 | // Sandbox verification and Snapshot tests |
| 87 | .option('--path-to-sandboxes <dir>', 'Subdirectory of project in which to target sandbox files', (v) => splitCommaSeparatedList(v, [])) |
| 88 | |
| 89 | // @angular/cli options |
| 90 | .option('--ng-cli-app <appName>', '@angular/cli appName') |
| 91 | .option('--ng-cli-host <ip>', '@angular/cli serve host ip', '127.0.0.1') |
| 92 | .option('--ng-cli-port <n>', '@angular/cli serve port', '4201') |
| 93 | .option('--ng-cli-cmd <path>', 'Path to @angular/cli executable', 'node_modules/@angular/cli/bin/ng') |
| 94 | .option('--ng-cli-args <list>', 'Additional @angular/cli arguments') |
| 95 | .option('--ng-cli-max-buffer <maxBuffer>', 'Specify a max buffer (for large apps)'); |
| 96 | |
| 97 | program.parse(argv); |
| 98 | return applyConfigurationFile(program.opts()); |
| 99 | } |
| 100 | |
| 101 | export function applyConfigurationFile(options: {[key: string]: any}): Config { |
| 102 | const playgroundConfig = loadConfig(options.config); |
no test coverage detected