@@ -40,7 +40,7 @@ describe('project generate manifest', () => {
4040 } ) ;
4141
4242 it ( 'should produce a manifest (package.xml) for ApexClass' , ( ) => {
43- const result = execCmd < Dictionary > ( 'force:source: manifest:create --metadata ApexClass --json' , {
43+ const result = execCmd < Dictionary > ( 'project generate manifest --metadata ApexClass --json' , {
4444 ensureExitCode : 0 ,
4545 } ) . jsonOutput ?. result ;
4646 expect ( result ) . to . be . ok ;
@@ -70,7 +70,7 @@ describe('project generate manifest', () => {
7070 const output = join ( 'abc' , 'def' ) ;
7171 const outputFile = join ( output , 'destructiveChanges.xml' ) ;
7272 const result = execCmd < Dictionary > (
73- `force:source: manifest:create --metadata ApexClass --manifesttype destroy --outputdir ${ output } --apiversion=51.0 --json` ,
73+ `project generate manifest --metadata ApexClass --manifesttype destroy --outputdir ${ output } --apiversion=51.0 --json` ,
7474 {
7575 ensureExitCode : 0 ,
7676 }
@@ -85,7 +85,7 @@ describe('project generate manifest', () => {
8585 const output = join ( 'abc' , 'def' ) ;
8686 const outputFile = join ( output , 'myNewManifest.xml' ) ;
8787 const result = execCmd < Dictionary > (
88- `force:source: manifest:create --metadata ApexClass --manifestname myNewManifest --outputdir ${ output } --json` ,
88+ `project generate manifest --metadata ApexClass --manifestname myNewManifest --outputdir ${ output } --json` ,
8989 {
9090 ensureExitCode : 0 ,
9191 }
@@ -96,50 +96,112 @@ describe('project generate manifest', () => {
9696
9797 it ( 'should produce a manifest in a directory with stdout output' , ( ) => {
9898 const output = join ( 'abc' , 'def' ) ;
99- const result = execCmd < Dictionary > ( `force:source: manifest:create --metadata ApexClass --outputdir ${ output } ` , {
99+ const result = execCmd < Dictionary > ( `project generate manifest --metadata ApexClass --outputdir ${ output } ` , {
100100 ensureExitCode : 0 ,
101101 } ) . shellOutput ;
102102 expect ( result ) . to . include ( `successfully wrote package.xml to ${ output } ` ) ;
103103 } ) ;
104104
105105 it ( 'should produce a manifest with stdout output' , ( ) => {
106- const result = execCmd < Dictionary > ( 'force:source: manifest:create --metadata ApexClass' , {
106+ const result = execCmd < Dictionary > ( 'project generate manifest --metadata ApexClass' , {
107107 ensureExitCode : 0 ,
108108 } ) . shellOutput ;
109109 expect ( result ) . to . include ( 'successfully wrote package.xml' ) ;
110110 } ) ;
111111
112- it ( 'should produce a manifest from metadata in an org' , async ( ) => {
113- const manifestName = 'org-metadata.xml' ;
114- const result = execCmd < Dictionary > ( `force:source:manifest:create --fromorg ${ orgAlias } -n ${ manifestName } --json` , {
115- ensureExitCode : 0 ,
116- } ) . jsonOutput ?. result ;
117- expect ( result ) . to . be . ok ;
118- expect ( result ) . to . include ( { path : manifestName , name : manifestName } ) ;
119- const stats = fs . statSync ( join ( session . project . dir , manifestName ) ) ;
120- expect ( stats . isFile ( ) ) . to . be . true ;
121- expect ( stats . size ) . to . be . greaterThan ( 100 ) ;
122- } ) ;
123-
124- it ( 'should produce the same manifest from an org every time' , async ( ) => {
125- config . truncateThreshold = 0 ;
112+ describe ( 'from org' , ( ) => {
113+ before ( async ( ) => {
114+ // Deploy all source in the project to the org so there's some metadata in it.
115+ execCmd < Dictionary > ( 'project deploy start' , { ensureExitCode : 0 } ) ;
116+ } ) ;
126117
127- execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-1.xml` , {
128- ensureExitCode : 0 ,
118+ it ( 'should produce a manifest from metadata in an org' , async ( ) => {
119+ const manifestName = 'org-metadata.xml' ;
120+ const result = execCmd < Dictionary > ( `project generate manifest --fromorg ${ orgAlias } -n ${ manifestName } --json` , {
121+ ensureExitCode : 0 ,
122+ } ) . jsonOutput ?. result ;
123+ expect ( result ) . to . be . ok ;
124+ expect ( result ) . to . include ( { path : manifestName , name : manifestName } ) ;
125+ const stats = fs . statSync ( join ( session . project . dir , manifestName ) ) ;
126+ expect ( stats . isFile ( ) ) . to . be . true ;
127+ expect ( stats . size ) . to . be . greaterThan ( 100 ) ;
129128 } ) ;
130- const manifest1 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-1.xml' ) , 'utf-8' ) ;
131129
132- execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-2.xml` , {
133- ensureExitCode : 0 ,
130+ it ( 'should produce a manifest from an include list of metadata in an org' , async ( ) => {
131+ const manifestName = 'org-metadata.xml' ;
132+ const includeList = 'ApexClass:FileUtil*,PermissionSet,Flow' ;
133+ execCmd < Dictionary > (
134+ `project generate manifest --fromorg ${ orgAlias } -n ${ manifestName } --metadata ${ includeList } --json` ,
135+ {
136+ ensureExitCode : 0 ,
137+ }
138+ ) ;
139+ const manifestContents = fs . readFileSync ( join ( session . project . dir , manifestName ) , 'utf-8' ) ;
140+
141+ const expectedManifestContents =
142+ '<?xml version="1.0" encoding="UTF-8"?>\n' +
143+ '<Package xmlns="http://soap.sforce.com/2006/04/metadata">\n' +
144+ ' <types>\n' +
145+ ' <members>FileUtilities</members>\n' +
146+ ' <members>FileUtilitiesTest</members>\n' +
147+ ' <name>ApexClass</name>\n' +
148+ ' </types>\n' +
149+ ' <types>\n' +
150+ ' <members>Create_property</members>\n' +
151+ ' <name>Flow</name>\n' +
152+ ' </types>\n' +
153+ ' <types>\n' +
154+ ' <members>dreamhouse</members>\n' +
155+ ' <members>sfdcInternalInt__sfdc_scrt2</members>\n' +
156+ ' <name>PermissionSet</name>\n' +
157+ ' </types>\n' +
158+ ' <version>61.0</version>\n' +
159+ '</Package>\n' ;
160+ expect ( manifestContents ) . to . equal ( expectedManifestContents ) ;
134161 } ) ;
135- const manifest2 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-2.xml' ) , 'utf-8' ) ;
136162
137- execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-3.xml` , {
138- ensureExitCode : 0 ,
163+ it ( 'should produce a manifest from an excluded list of metadata in an org' , async ( ) => {
164+ const manifestName = 'org-metadata.xml' ;
165+ const excludedList = 'ApexClass,CustomObject,StandardValueSet' ;
166+ execCmd < Dictionary > (
167+ `project generate manifest --fromorg ${ orgAlias } -n ${ manifestName } --excluded-metadata ${ excludedList } --json` ,
168+ {
169+ ensureExitCode : 0 ,
170+ }
171+ ) ;
172+ const manifestContents = fs . readFileSync ( join ( session . project . dir , manifestName ) , 'utf-8' ) ;
173+
174+ // should NOT have these entries
175+ expect ( manifestContents ) . to . not . contain ( '<name>ApexClass</name>' ) ;
176+ expect ( manifestContents ) . to . not . contain ( '<name>CustomObject</name>' ) ;
177+ expect ( manifestContents ) . to . not . contain ( '<name>StandardValueSet</name>' ) ;
178+
179+ // should have these entries
180+ expect ( manifestContents ) . to . contain ( '<name>Layout</name>' ) ;
181+ expect ( manifestContents ) . to . contain ( '<name>CustomLabels</name>' ) ;
182+ expect ( manifestContents ) . to . contain ( '<name>Profile</name>' ) ;
139183 } ) ;
140- const manifest3 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-3.xml' ) , 'utf-8' ) ;
141184
142- expect ( manifest1 ) . to . equal ( manifest2 ) ;
143- expect ( manifest2 ) . to . equal ( manifest3 ) ;
185+ it ( 'should produce the same manifest from an org every time' , async ( ) => {
186+ config . truncateThreshold = 0 ;
187+
188+ execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-1.xml` , {
189+ ensureExitCode : 0 ,
190+ } ) ;
191+ const manifest1 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-1.xml' ) , 'utf-8' ) ;
192+
193+ execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-2.xml` , {
194+ ensureExitCode : 0 ,
195+ } ) ;
196+ const manifest2 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-2.xml' ) , 'utf-8' ) ;
197+
198+ execCmd < Dictionary > ( `project generate manifest --from-org ${ orgAlias } -n org-metadata-3.xml` , {
199+ ensureExitCode : 0 ,
200+ } ) ;
201+ const manifest3 = fs . readFileSync ( join ( session . project . dir , 'org-metadata-3.xml' ) , 'utf-8' ) ;
202+
203+ expect ( manifest1 ) . to . equal ( manifest2 ) ;
204+ expect ( manifest2 ) . to . equal ( manifest3 ) ;
205+ } ) ;
144206 } ) ;
145207} ) ;
0 commit comments