diff --git a/messages/logout.md b/messages/logout.md index c5e8cfad..293baaf8 100644 --- a/messages/logout.md +++ b/messages/logout.md @@ -79,3 +79,9 @@ You must specify a target-org (or default target-org config is set) or use --all # noOrgSpecifiedWithJson You must specify a target-org (or default target-org config is set) or use --all flag when using the --json flag. + +# warning.NoAuthFoundForTargetOrg + +No authenticated org found with the %s username or alias. + +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. diff --git a/src/commands/org/logout.ts b/src/commands/org/logout.ts index 71936501..bc1f6ddd 100644 --- a/src/commands/org/logout.ts +++ b/src/commands/org/logout.ts @@ -88,6 +88,7 @@ export default class Logout extends SfCommand { if (orgAuths.length === 0) { if (flags['target-org']) { + this.warn(messages.createWarning('warning.NoAuthFoundForTargetOrg', [flags['target-org']])); // user specified a target org but it was not resolved, issue success message and return this.logSuccess(messages.getMessage('logoutOrgCommandSuccess', [flags['target-org']])); return [flags['target-org']]; diff --git a/test/commands/org/logout.test.ts b/test/commands/org/logout.test.ts index 2483b2a8..4181bcff 100644 --- a/test/commands/org/logout.test.ts +++ b/test/commands/org/logout.test.ts @@ -151,7 +151,7 @@ describe('org:logout', () => { expect(response).to.deep.equal([testOrg1.username]); }); - it('should not fail when the auth file does not exist', async () => { + it('should fail when the auth file does not exist', async () => { await prepareStubs({ 'target-org': testOrg2.username, aliases: { TestAlias: testOrg1.username },