@@ -111,8 +111,7 @@ async function init() {
111
111
needsRouter ? : boolean
112
112
needsPinia ? : boolean
113
113
needsVitest ? : boolean
114
- needsCypress ? : boolean
115
- needsPlaywright ? : boolean
114
+ needsE2eTesting ? : false | 'cypress' | 'playwright'
116
115
needsEslint ? : boolean
117
116
needsPrettier ? : boolean
118
117
} = { }
@@ -206,28 +205,24 @@ async function init() {
206
205
inactive : 'No'
207
206
} ,
208
207
{
209
- name : 'needsCypress' ,
210
- type : ( ) => ( isFeatureFlagsUsed ? null : 'toggle' ) ,
211
- message : ( prev , answers ) =>
212
- answers . needsVitest
213
- ? 'Add Cypress for End-to-End testing?'
214
- : 'Add Cypress for both Unit and End-to-End testing?' ,
215
- initial : false ,
216
- active : 'Yes' ,
217
- inactive : 'No'
218
- } ,
219
- {
220
- name : 'needsPlaywright' ,
221
- type : ( prev , values ) => {
222
- if ( isFeatureFlagsUsed || values . needsCypress ) {
223
- return null
208
+ name : 'needsE2eTesting' ,
209
+ type : ( ) => ( isFeatureFlagsUsed ? null : 'select' ) ,
210
+ message : 'Add an End-to-End Testing Solution?' ,
211
+ initial : 0 ,
212
+ choices : ( prev , anwsers ) => [
213
+ { title : 'No' , value : false } ,
214
+ {
215
+ title : 'Cypress' ,
216
+ description : anwsers . needsVitest
217
+ ? undefined
218
+ : 'also supports unit testing with Cypress Component Testing' ,
219
+ value : 'cypress'
220
+ } ,
221
+ {
222
+ title : 'Playwright' ,
223
+ value : 'playwright'
224
224
}
225
- return 'toggle'
226
- } ,
227
- message : 'Add Playwright for End-to-End testing?' ,
228
- initial : false ,
229
- active : 'Yes' ,
230
- inactive : 'No'
225
+ ]
231
226
} ,
232
227
{
233
228
name : 'needsEslint' ,
@@ -272,13 +267,16 @@ async function init() {
272
267
needsTypeScript = argv . typescript ,
273
268
needsRouter = argv . router ,
274
269
needsPinia = argv . pinia ,
275
- needsCypress = argv . cypress || argv . tests ,
276
- needsPlaywright = argv . playwright ,
277
270
needsVitest = argv . vitest || argv . tests ,
278
271
needsEslint = argv . eslint || argv [ 'eslint-with-prettier' ] ,
279
272
needsPrettier = argv [ 'eslint-with-prettier' ]
280
273
} = result
274
+
275
+ const { needsE2eTesting } = result
276
+ const needsCypress = argv . cypress || argv . tests || needsE2eTesting === 'cypress'
281
277
const needsCypressCT = needsCypress && ! needsVitest
278
+ const needsPlaywright = argv . playwright || needsE2eTesting === 'playwright'
279
+
282
280
const root = path . join ( cwd , targetDir )
283
281
284
282
if ( fs . existsSync ( root ) && shouldOverwrite ) {
0 commit comments