diff --git a/packages/cli-test/src/cli/cli-process.spec.ts b/packages/cli-test/src/cli/cli-process.spec.ts index 1ca719140..cc97b8e7c 100644 --- a/packages/cli-test/src/cli/cli-process.spec.ts +++ b/packages/cli-test/src/cli/cli-process.spec.ts @@ -140,6 +140,15 @@ describe('SlackCLIProcess class', () => { ); spawnProcessSpy.resetHistory(); }); + it('should map verbose option to `--verbose`', async () => { + let cmd = new SlackCLIProcess(['help'], { verbose: true }); + await cmd.execAsync(); + sandbox.assert.calledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--verbose'])); + spawnProcessSpy.resetHistory(); + cmd = new SlackCLIProcess(['help']); + await cmd.execAsync(); + sandbox.assert.neverCalledWith(spawnProcessSpy, sinon.match.string, sinon.match.array.contains(['--verbose'])); + }); }); describe('command options', () => { it('should pass command-level key/value options to command in the form `-- value`', async () => { diff --git a/packages/cli-test/src/cli/cli-process.ts b/packages/cli-test/src/cli/cli-process.ts index 54aac020d..6b13bf47c 100644 --- a/packages/cli-test/src/cli/cli-process.ts +++ b/packages/cli-test/src/cli/cli-process.ts @@ -39,6 +39,8 @@ export interface SlackCLIGlobalOptions { team?: string; /** @description Access token to use when making Slack API calls. */ token?: string; + /** @description Print debug logging and additional CLI information. */ + verbose?: boolean; } export type SlackCLIHostTargetOptions = Pick; @@ -144,6 +146,9 @@ export class SlackCLIProcess { if (opts.token) { cmd = cmd.concat(['--token', opts.token]); } + if (opts.verbose) { + cmd = cmd.concat(['--verbose']); + } } else { cmd = cmd.concat(['--skip-update', '--force', '--app', 'deployed']); } diff --git a/packages/cli-test/src/cli/commands/auth.ts b/packages/cli-test/src/cli/commands/auth.ts index ad9eb69dc..f23e04f93 100644 --- a/packages/cli-test/src/cli/commands/auth.ts +++ b/packages/cli-test/src/cli/commands/auth.ts @@ -7,13 +7,21 @@ import { import type { ShellProcess } from '../../types/shell'; +type AuthLoginNoPromptArguments = SlackCLIHostTargetOptions & Pick; +type AuthLoginChallengeExchangeArugments = SlackCLIHostTargetOptions & { + /** @description Challenge string extracted from the Slack client UI after submitting the auth slash command. */ + challenge: string; + /** @description The `authTicket` output from `loginNoPrompt`; required to complete the login flow. */ + authTicket: string; +} & Pick; + export default { /** * `slack login --no-prompt`; initiates a CLI login flow. The `authTicketSlashCommand` returned should be entered * into the Slack client, and the challenge code retrieved and fed into the `loginChallengeExchange` method to * complete the CLI login flow. */ - loginNoPrompt: async function loginNoPrompt(args?: SlackCLIHostTargetOptions): Promise<{ + loginNoPrompt: async function loginNoPrompt(args?: AuthLoginNoPromptArguments): Promise<{ /** @description Command output */ output: ShellProcess['output']; /** @@ -57,12 +65,7 @@ export default { * @returns */ loginChallengeExchange: async function loginChallengeExchange( - args: SlackCLIHostTargetOptions & { - /** @description Challenge string extracted from the Slack client UI after submitting the auth slash command. */ - challenge: string; - /** @description The `authTicket` output from `loginNoPrompt`; required to complete the login flow. */ - authTicket: string; - }, + args: AuthLoginChallengeExchangeArugments, ): Promise { const cmd = new SlackCLIProcess(['login'], args, { '--no-prompt': true,