diff --git a/packages/js/e2e-environment/utils/scaffold.js b/packages/js/e2e-environment/utils/scaffold.js index 580e40a9b7c..1a3aa978bae 100644 --- a/packages/js/e2e-environment/utils/scaffold.js +++ b/packages/js/e2e-environment/utils/scaffold.js @@ -55,11 +55,11 @@ const confirmLocalCopy = ( localE2ePath, packageE2ePath, packageName = '', force const confirmPrompt = `${localE2ePath} already exists. Overwrite? [Y]es/[n]o: `; let overwriteFiles; - if ( !fs.existsSync( localPath ) || force ) { - overwriteFiles = 'y'; - } else { + if ( ! force && fs.existsSync( localPath ) ) { overwriteFiles = confirm( confirmPrompt, 'ny' ); overwriteFiles = overwriteFiles.toLowerCase(); + } else { + overwriteFiles = 'y'; } if ( overwriteFiles == 'y' ) { fs.copyFileSync( packagePath, localPath );