Skip to content

Commit

Permalink
feat (cli-test): logout only logs out of the specified team, plus `…
Browse files Browse the repository at this point in the history
…shouldLogOut` parameter (#1852)
  • Loading branch information
filmaj authored Jul 25, 2024
1 parent 966d8d9 commit 0fd3eb8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/cli-test/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}: {
Expand All @@ -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<void> {
Expand All @@ -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}`);
}
}
},
};

0 comments on commit 0fd3eb8

Please sign in to comment.