From 0fd3eb88fb59e80fcd14cf250b32cc3e257434f3 Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 25 Jul 2024 16:33:38 +0000 Subject: [PATCH] feat (cli-test): `logout` only logs out of the specified team, plus `shouldLogOut` parameter (#1852) --- packages/cli-test/src/cli/index.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/cli-test/src/cli/index.ts b/packages/cli-test/src/cli/index.ts index 58966d8e1..0a6354fa2 100644 --- a/packages/cli-test/src/cli/index.ts +++ b/packages/cli-test/src/cli/index.ts @@ -60,12 +60,13 @@ export const SlackCLI = { }, /** - * Delete app and Log out of all sessions + * Delete app and Log out of current team session * @param options */ stopSession: async function stopSession({ appPath, appTeamID, + shouldLogOut = true, isLocalApp, qa, }: { @@ -75,6 +76,8 @@ export const SlackCLI = { appPath?: string; /** Team domain or ID where app is installed */ appTeamID: string; + /** Should the CLI log out of its session with the team specified by `appTeamID`. Defaults to `true` */ + shouldLogOut?: boolean; isLocalApp?: boolean; qa?: boolean; }): Promise { @@ -99,12 +102,13 @@ export const SlackCLI = { } } - // Log out if logged in - try { - await SlackCLI.logout({ allWorkspaces: true, qa }); - } catch (error) { - // TODO: maybe should error instead? this seems pretty bad - logger.warn(`Could not logout gracefully. Error: ${error}`); + if (shouldLogOut) { + try { + await SlackCLI.logout({ teamFlag: appTeamID, qa }); + } catch (error) { + // TODO: maybe should error instead? this seems pretty bad + logger.warn(`Could not logout gracefully. Error: ${error}`); + } } }, };