Skip to content

Commit aa25546

Browse files
Sl/W-18067456 - fix org logout fails username (#1282)
* fix: update fail username * fix: update logout test * fix: remove only in the test file * fix: update exitCode * fix: update exitcode in test:nut * fix: update the ExitCode when giving unauthenticated orgs * fix: rerun the test * fix: testing * fix: remove the afterEach hook * fix: remove skip in the jwt test nut * fix: remove the error and add the warning instead * fix: remove only * Update messages/logout.md Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com> --------- Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
1 parent 848a8e9 commit aa25546

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

messages/logout.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,9 @@ You must specify a target-org (or default target-org config is set) or use --all
7979
# noOrgSpecifiedWithJson
8080

8181
You must specify a target-org (or default target-org config is set) or use --all flag when using the --json flag.
82+
83+
# warning.NoAuthFoundForTargetOrg
84+
85+
No authenticated org found with the %s username or alias.
86+
87+
NOTE: Starting September 2025, this warning will be converted to an error. As a result, the exit code when you try to log out of an unauthenticated org will change from 0 to 1.

src/commands/org/logout.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export default class Logout extends SfCommand<AuthLogoutResults> {
8888

8989
if (orgAuths.length === 0) {
9090
if (flags['target-org']) {
91+
this.warn(messages.createWarning('warning.NoAuthFoundForTargetOrg', [flags['target-org']]));
9192
// user specified a target org but it was not resolved, issue success message and return
9293
this.logSuccess(messages.getMessage('logoutOrgCommandSuccess', [flags['target-org']]));
9394
return [flags['target-org']];

test/commands/org/logout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('org:logout', () => {
151151
expect(response).to.deep.equal([testOrg1.username]);
152152
});
153153

154-
it('should not fail when the auth file does not exist', async () => {
154+
it('should fail when the auth file does not exist', async () => {
155155
await prepareStubs({
156156
'target-org': testOrg2.username,
157157
aliases: { TestAlias: testOrg1.username },

0 commit comments

Comments
 (0)