File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
src/commands/force/org/beta Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -263,10 +263,8 @@ export class Create extends SfdxCommand {
263263
264264 private async setAliasAndDefaultUsername ( username : string ) : Promise < void > {
265265 if ( this . flags . setalias ) {
266- const alias = await Aliases . create ( Aliases . getDefaultOptions ( ) ) ;
267- alias . set ( this . flags . setalias , username ) ;
268- const result = await alias . write ( ) ;
269- this . logger . debug ( 'Set Alias: %s result: %s' , this . flags . setalias , result ) ;
266+ await Aliases . parseAndUpdate ( [ `${ this . flags . setalias as string } =${ username } ` ] ) ;
267+ this . logger . debug ( 'Set Alias: %s result: %s' , this . flags . setalias ) ;
270268 }
271269 if ( this . flags . setdefaultusername ) {
272270 let config : Config ;
Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ describe('org:create', () => {
184184 '--type' ,
185185 'scratch' ,
186186 '--setalias' ,
187- 'sandboxAlias ' ,
187+ 'scratchOrgAlias ' ,
188188 '--setdefaultusername' ,
189189 '--definitionfile' ,
190190 definitionfile ,
@@ -198,7 +198,7 @@ describe('org:create', () => {
198198 ...CREATE_RESULT ,
199199 username : 'newScratchUsername' ,
200200 } ) ;
201- const aliasStub = stubMethod ( sandbox , Aliases . prototype , 'set ' ) ;
201+ const aliasStub = stubMethod ( sandbox , Aliases , 'parseAndUpdate ' ) ;
202202 const configStub = stubMethod ( sandbox , Config . prototype , 'set' ) ;
203203 await command . runIt ( ) ;
204204 expect ( prodOrg . firstCall . args [ 0 ] ) . to . deep . equal ( {
@@ -216,7 +216,7 @@ describe('org:create', () => {
216216 retry : 0 ,
217217 orgConfig : { } ,
218218 } ) ;
219- expect ( aliasStub . firstCall . args ) . to . deep . equal ( [ 'sandboxAlias' , ' newScratchUsername'] ) ;
219+ expect ( aliasStub . firstCall . args ) . to . deep . equal ( [ [ 'scratchOrgAlias= newScratchUsername'] ] ) ;
220220 expect ( configStub . firstCall . args ) . to . deep . equal ( [ 'defaultusername' , 'newScratchUsername' ] ) ;
221221 } ) ;
222222
You can’t perform that action at this time.
0 commit comments