File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
src/commands/project/retrieve Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -354,6 +354,11 @@ export default class RetrieveMetadata extends SfCommand<RetrieveResultJson> {
354354 ) ;
355355 return directories ;
356356 }
357+ // If we retrieved only a package.xml, just return.
358+ if ( this . retrieveResult . getFileResponses ( ) . length < 2 ) {
359+ return ;
360+ }
361+
357362 // getFileResponses fails once the files have been moved, calculate where they're moved to, and then move them
358363 this . retrieveResult . getFileResponses ( ) . forEach ( ( fileResponse ) => {
359364 fileResponse . filePath = fileResponse . filePath ?. replace ( join ( 'main' , 'default' ) , '' ) ;
Original file line number Diff line number Diff line change @@ -83,6 +83,20 @@ describe('retrieve metadata NUTs', () => {
8383 await testkit . expect . filesToBeRetrieved ( [ 'myOutput/classes/*' , 'myOutput/aura/**/*' ] ) ;
8484 } ) ;
8585
86+ it ( 'should warn when nothing retrieved into output-dir and not throw ENOENT' , async ( ) => {
87+ const result = await testkit . retrieve ( { args : '--metadata ApexClass:NonExistant --output-dir myOutput' } ) ;
88+ expect ( result ?. status ) . to . equal ( 0 ) ;
89+ const retrieveResult = result ?. result as unknown as RetrieveResultJson ;
90+ expect ( retrieveResult . success ) . to . equal ( true ) ;
91+ expect ( retrieveResult . fileProperties ) . to . be . an ( 'array' ) . with . lengthOf ( 1 ) ;
92+ expect ( retrieveResult . messages ) . to . deep . equal ( [
93+ {
94+ fileName : 'unpackaged/package.xml' ,
95+ problem : "Entity of type 'ApexClass' named 'NonExistant' cannot be found" ,
96+ } ,
97+ ] ) ;
98+ } ) ;
99+
86100 it ( 'should retrieve ApexClasses from wildcard match' , async ( ) => {
87101 const response = await testkit . retrieve ( { args : '--metadata "ApexClass:Test*"' } ) ;
88102 expect ( response ?. status ) . to . equal ( 0 ) ;
You can’t perform that action at this time.
0 commit comments