@@ -56,6 +56,35 @@ describe('createPluginSteps', () => {
5656 } )
5757 } )
5858
59+ it ( 'plugin dry-run omits commit and remote tag; still checks out, clears, adds' , async ( ) => {
60+ const fs = createRecordingFs ( )
61+ const exec = createRecordingExec ( )
62+ const steps = createPluginSteps ( baseSettings , { exec, fs, awk, noRunIfEmpty, dryRun : true } )
63+ let s = baseSettings
64+ for ( const step of steps ) {
65+ s = await step ( s )
66+ }
67+
68+ const trunk = path . join ( svnPath , 'trunk' )
69+ const url = baseSettings . url
70+ const addCmd =
71+ 'svn resolve --accept working -R . && svn status |awk \'/^[?]/{print $2}\' | xargs svn add;' +
72+ 'svn status | awk \'/^[!]/{print $2}\' | xargs svn delete;'
73+
74+ assert . deepStrictEqual ( exec . calls , [
75+ {
76+ cmd : `svn co --force-interactive --username="jane" ${ url } trunk/ ${ trunk } ` ,
77+ opts : { maxBuffer : baseSettings . maxBuffer }
78+ } ,
79+ { cmd : `rm -fr ${ trunk } /*` , opts : { } } ,
80+ { cmd : addCmd , opts : { cwd : trunk } }
81+ ] )
82+
83+ assert . deepStrictEqual ( fs . copies , [
84+ { src : 'dist/' , dest : path . join ( svnPath , 'trunk' ) + path . sep }
85+ ] )
86+ } )
87+
5988 it ( 'full plugin (deployTrunk + deployTag) runs expected exec commands and cwd' , async ( ) => {
6089 const fs = createRecordingFs ( )
6190 const exec = createRecordingExec ( )
@@ -135,6 +164,39 @@ describe('createPluginSteps', () => {
135164 ] )
136165 } )
137166
167+ it ( 'plugin with deployAssets and dryRun skips trunk, tag, and assets commits' , async ( ) => {
168+ const fs = createRecordingFs ( )
169+ const exec = createRecordingExec ( )
170+ const settings = { ...baseSettings , deployAssets : true }
171+ const steps = createPluginSteps ( settings , { exec, fs, awk, noRunIfEmpty, dryRun : true } )
172+ let s = settings
173+ for ( const step of steps ) {
174+ s = await step ( s )
175+ }
176+
177+ const trunk = path . join ( svnPath , 'trunk' )
178+ const assets = path . join ( svnPath , 'assets' )
179+ const url = settings . url
180+ const addCmd =
181+ 'svn resolve --accept working -R . && svn status |awk \'/^[?]/{print $2}\' | xargs svn add;' +
182+ 'svn status | awk \'/^[!]/{print $2}\' | xargs svn delete;'
183+
184+ assert . strictEqual ( exec . calls . length , 6 )
185+ assert . strictEqual ( exec . calls [ 0 ] . cmd , `svn co --force-interactive --username="jane" ${ url } trunk/ ${ trunk } ` )
186+ assert . strictEqual ( exec . calls [ 1 ] . cmd , `rm -fr ${ trunk } /*` )
187+ assert . strictEqual ( exec . calls [ 2 ] . cmd , addCmd )
188+ assert . strictEqual ( exec . calls [ 2 ] . opts . cwd , trunk )
189+ assert . strictEqual ( exec . calls [ 3 ] . cmd , `svn co --force-interactive --username="jane" ${ url } assets/ ${ assets } ` )
190+ assert . strictEqual ( exec . calls [ 4 ] . cmd , `rm -fr ${ assets } /*` )
191+ assert . strictEqual ( exec . calls [ 5 ] . cmd , addCmd )
192+ assert . strictEqual ( exec . calls [ 5 ] . opts . cwd , assets )
193+
194+ const noCommit = exec . calls . every ( ( c ) => ! c . cmd . includes ( 'svn commit' ) )
195+ assert . strictEqual ( noCommit , true )
196+ const noRemoteTag = exec . calls . every ( ( c ) => ! c . cmd . includes ( 'tags/' ) )
197+ assert . strictEqual ( noRemoteTag , true )
198+ } )
199+
138200 it ( 'plugin with deployAssets true includes assets checkout, copy, svn add, commit with cwd' , async ( ) => {
139201 const fs = createRecordingFs ( )
140202 const exec = createRecordingExec ( )
@@ -221,6 +283,39 @@ describe('createThemeSteps', () => {
221283 } )
222284 } )
223285
286+ it ( 'theme dry-run omits final svn commit' , async ( ) => {
287+ const fs = createRecordingFs ( )
288+ const exec = createRecordingExec ( )
289+ const steps = createThemeSteps ( baseSettings , { exec, fs, awk, noRunIfEmpty, dryRun : true } )
290+ let s = baseSettings
291+ for ( const step of steps ) {
292+ s = await step ( s )
293+ }
294+
295+ const verDir = path . join ( svnPath , baseSettings . newVersion )
296+ const addCmd =
297+ 'svn resolve --accept working -R . && svn status |awk \'/^[?]/{print $2}\' | xargs svn add;' +
298+ 'svn status | awk \'/^[!]/{print $2}\' | xargs svn delete;'
299+
300+ assert . deepStrictEqual ( exec . calls , [
301+ { cmd : `rm -fr ${ svnPath } ` , opts : { } } ,
302+ {
303+ cmd : `svn co --force-interactive --username="jane" ${ baseSettings . url } / ${ svnPath } ` ,
304+ opts : { maxBuffer : baseSettings . maxBuffer }
305+ } ,
306+ {
307+ cmd : 'svn copy 1.0.0 2.0.0' ,
308+ opts : { cwd : svnPath }
309+ } ,
310+ { cmd : `rm -fr ${ verDir } /*` , opts : { } } ,
311+ { cmd : addCmd , opts : { cwd : verDir } }
312+ ] )
313+
314+ assert . deepStrictEqual ( fs . copies , [
315+ { src : 'dist/' , dest : path . join ( svnPath , '2.0.0' ) + path . sep }
316+ ] )
317+ } )
318+
224319 it ( 'theme pipeline runs expected exec commands, cwd, and copySync destinations' , async ( ) => {
225320 const fs = createRecordingFs ( )
226321 const exec = createRecordingExec ( )
0 commit comments