Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (cli-test): logout only logs out of the specified team, plus shouldLogOut parameter #1852

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`);
}
}
},
};