diff --git a/packages/cli/e2e/run-checkly.ts b/packages/cli/e2e/run-checkly.ts index d65bc012..aaa19c66 100644 --- a/packages/cli/e2e/run-checkly.ts +++ b/packages/cli/e2e/run-checkly.ts @@ -37,6 +37,7 @@ export function runChecklyCli (options: { // Once 4.8.0 has been released, we can remove the 4.8.0 fallback here. CHECKLY_CLI_VERSION: cliVersion ?? '4.8.0', CHECKLY_E2E_PROMPTS_INJECTIONS: promptsInjection?.length ? JSON.stringify(promptsInjection) : undefined, + CHECKLY_E2E_DISABLE_FANCY_OUTPUT: '1', ...env, }, cwd: directory ?? process.cwd(), diff --git a/packages/cli/src/commands/baseCommand.ts b/packages/cli/src/commands/baseCommand.ts index 691312cc..33ed29d7 100644 --- a/packages/cli/src/commands/baseCommand.ts +++ b/packages/cli/src/commands/baseCommand.ts @@ -10,6 +10,7 @@ export type BaseCommandClass = typeof Command & { export abstract class BaseCommand extends Command { static coreCommand = false static hidden = true + fancy = true protected async init (): Promise { let version = process.env.CHECKLY_CLI_VERSION ?? this.config.version @@ -35,6 +36,10 @@ export abstract class BaseCommand extends Command { } } + if (process.env.CHECKLY_E2E_DISABLE_FANCY_OUTPUT) { + this.fancy = false + } + return super.init() } diff --git a/packages/cli/src/commands/deploy.ts b/packages/cli/src/commands/deploy.ts index 7a229b4d..ddbdaa2e 100644 --- a/packages/cli/src/commands/deploy.ts +++ b/packages/cli/src/commands/deploy.ts @@ -74,7 +74,9 @@ export default class Deploy extends AuthCommand { } async run (): Promise { - ux.action.start('Parsing your project', undefined, { stdout: true }) + if (this.fancy) { + ux.action.start('Parsing your project', undefined, { stdout: true }) + } const { flags } = await this.parse(Deploy) const { force, @@ -113,7 +115,10 @@ export default class Deploy extends AuthCommand { checklyConfigConstructs, }) const repoInfo = getGitInformation(project.repoUrl) - ux.action.stop() + + if (this.fancy) { + ux.action.stop() + } if (!preview) { for (const check of Object.values(project.data.check)) { diff --git a/packages/cli/src/commands/sync-playwright.ts b/packages/cli/src/commands/sync-playwright.ts index 3cbea15e..e4b691d8 100644 --- a/packages/cli/src/commands/sync-playwright.ts +++ b/packages/cli/src/commands/sync-playwright.ts @@ -12,7 +12,9 @@ export default class SyncPlaywright extends BaseCommand { static description = 'Copy Playwright config into the Checkly config file.' async run (): Promise { - ux.action.start('Syncing Playwright config to the Checkly config file', undefined, { stdout: true }) + if (this.fancy) { + ux.action.start('Syncing Playwright config to the Checkly config file', undefined, { stdout: true }) + } const config = await loadPlaywrightConfig() if (!config) { @@ -40,13 +42,17 @@ export default class SyncPlaywright extends BaseCommand { const dir = path.resolve(path.dirname(configFile.fileName)) this.reWriteChecklyConfigFile(checklyConfigData, configFile.fileName, dir) - ux.action.stop('✅ ') + if (this.fancy) { + ux.action.stop('✅ ') + } this.log('Successfully updated Checkly config file') this.exit(0) } private handleError (message: string) { - ux.action.stop('❌') + if (this.fancy) { + ux.action.stop('❌') + } this.log(message) this.exit(1) } diff --git a/packages/cli/src/commands/test.ts b/packages/cli/src/commands/test.ts index 087f9a36..7a86873b 100644 --- a/packages/cli/src/commands/test.ts +++ b/packages/cli/src/commands/test.ts @@ -124,7 +124,9 @@ export default class Test extends AuthCommand { static strict = false async run (): Promise { - ux.action.start('Parsing your project', undefined, { stdout: true }) + if (this.fancy) { + ux.action.start('Parsing your project', undefined, { stdout: true }) + } const { flags, argv } = await this.parse(Test) const { @@ -228,7 +230,9 @@ export default class Test extends AuthCommand { check.snapshots = await uploadSnapshots(check.rawSnapshots) } - ux.action.stop() + if (this.fancy) { + ux.action.stop() + } if (!checks.length) { this.log(`Unable to find checks to run${filePatterns[0] !== '.*' ? ' using [FILEARGS]=\'' + filePatterns + '\'' : ''}.`)