@@ -127,7 +127,7 @@ describe('cleanupFiles', () => {
127127 const commands = getExecFileCommands ( )
128128 const homeFolder = 'src/components/pageComponents/home'
129129 expect ( commands ) . toContain ( `rm -rf ${ homeFolder } /Examples/demos/subgraphs` )
130- expect ( commands ) . toContain ( `rm ${ homeFolder } /Examples/index.tsx` )
130+ expect ( commands ) . toContain ( `rm -f ${ homeFolder } /Examples/index.tsx` )
131131 expect ( commands ) . toContain (
132132 `cp .install-files/home/Examples/index.tsx ${ homeFolder } /Examples/index.tsx` ,
133133 )
@@ -155,7 +155,7 @@ describe('cleanupFiles', () => {
155155 await cleanupFiles ( '/project/my_app' , 'custom' , [ 'demo' , 'subgraph' , 'vocs' , 'husky' ] )
156156
157157 const commands = getExecFileCommands ( )
158- expect ( commands ) . toContain ( 'rm typedoc.json' )
158+ expect ( commands ) . toContain ( 'rm -f typedoc.json' )
159159 } )
160160
161161 it ( 'removes typedoc:build from package.json scripts' , async ( ) => {
@@ -172,7 +172,7 @@ describe('cleanupFiles', () => {
172172 await cleanupFiles ( '/project/my_app' , 'custom' , [ 'demo' , 'subgraph' , 'typedoc' , 'husky' ] )
173173
174174 const commands = getExecFileCommands ( )
175- expect ( commands ) . toContain ( 'rm vocs.config.ts' )
175+ expect ( commands ) . toContain ( 'rm -f vocs.config.ts' )
176176 expect ( commands ) . toContain ( 'rm -rf docs' )
177177 } )
178178
@@ -193,8 +193,8 @@ describe('cleanupFiles', () => {
193193
194194 const commands = getExecFileCommands ( )
195195 expect ( commands ) . toContain ( 'rm -rf .husky' )
196- expect ( commands ) . toContain ( 'rm .lintstagedrc.mjs' )
197- expect ( commands ) . toContain ( 'rm commitlint.config.js' )
196+ expect ( commands ) . toContain ( 'rm -f .lintstagedrc.mjs' )
197+ expect ( commands ) . toContain ( 'rm -f commitlint.config.js' )
198198 } )
199199
200200 it ( 'removes prepare from package.json scripts' , async ( ) => {
@@ -213,8 +213,8 @@ describe('cleanupFiles', () => {
213213 const commands = getExecFileCommands ( )
214214 expect ( commands ) . toContain ( 'rm -rf src/components/pageComponents/home' )
215215 expect ( commands ) . toContain ( 'rm -rf src/subgraphs' )
216- expect ( commands ) . toContain ( 'rm typedoc.json' )
217- expect ( commands ) . toContain ( 'rm vocs.config.ts' )
216+ expect ( commands ) . toContain ( 'rm -f typedoc.json' )
217+ expect ( commands ) . toContain ( 'rm -f vocs.config.ts' )
218218 expect ( commands ) . toContain ( 'rm -rf .husky' )
219219 expect ( commands ) . toContain ( 'rm -rf .install-files' )
220220 } )
@@ -243,6 +243,16 @@ describe('cleanupFiles', () => {
243243 expect ( commands . at ( - 1 ) ) . toBe ( 'rm -rf .install-files' )
244244 } )
245245
246+ it ( 'uses -f flag on all single-file rm calls for idempotent cleanup' , async ( ) => {
247+ await cleanupFiles ( '/project/my_app' , 'custom' , [ ] )
248+
249+ const commands = getExecFileCommands ( )
250+ const rmCommands = commands . filter ( ( cmd ) => cmd . startsWith ( 'rm ' ) )
251+ for ( const cmd of rmCommands ) {
252+ expect ( cmd ) . toMatch ( / ^ r m - [ r f ] / )
253+ }
254+ } )
255+
246256 describe ( 'onProgress callback' , ( ) => {
247257 it ( 'reports only Install script for full mode' , async ( ) => {
248258 const steps : string [ ] = [ ]
0 commit comments