Skip to content

Commit 2a3378d

Browse files
committed
feat: use select prompt for E2E testing solutions
1 parent 0a76f07 commit 2a3378d

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

index.ts

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ async function init() {
111111
needsRouter?: boolean
112112
needsPinia?: boolean
113113
needsVitest?: boolean
114-
needsCypress?: boolean
115-
needsPlaywright?: boolean
114+
needsE2eTesting?: false | 'cypress' | 'playwright'
116115
needsEslint?: boolean
117116
needsPrettier?: boolean
118117
} = {}
@@ -206,28 +205,24 @@ async function init() {
206205
inactive: 'No'
207206
},
208207
{
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'
224224
}
225-
return 'toggle'
226-
},
227-
message: 'Add Playwright for End-to-End testing?',
228-
initial: false,
229-
active: 'Yes',
230-
inactive: 'No'
225+
]
231226
},
232227
{
233228
name: 'needsEslint',
@@ -272,13 +267,16 @@ async function init() {
272267
needsTypeScript = argv.typescript,
273268
needsRouter = argv.router,
274269
needsPinia = argv.pinia,
275-
needsCypress = argv.cypress || argv.tests,
276-
needsPlaywright = argv.playwright,
277270
needsVitest = argv.vitest || argv.tests,
278271
needsEslint = argv.eslint || argv['eslint-with-prettier'],
279272
needsPrettier = argv['eslint-with-prettier']
280273
} = result
274+
275+
const { needsE2eTesting } = result
276+
const needsCypress = argv.cypress || argv.tests || needsE2eTesting === 'cypress'
281277
const needsCypressCT = needsCypress && !needsVitest
278+
const needsPlaywright = argv.playwright || needsE2eTesting === 'playwright'
279+
282280
const root = path.join(cwd, targetDir)
283281

284282
if (fs.existsSync(root) && shouldOverwrite) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy