@@ -14,6 +14,7 @@ import { postOrderDirectoryTraverse, preOrderDirectoryTraverse } from './utils/d
14
14
import generateReadme from './utils/generateReadme'
15
15
import getCommand from './utils/getCommand'
16
16
import renderEslint from './utils/renderEslint'
17
+ import { FILES_TO_FILTER } from './utils/filterList'
17
18
18
19
function isValidPackageName ( projectName ) {
19
20
return / ^ (?: @ [ a - z 0 - 9 - * ~ ] [ a -z 0 -9 -* ._ ~ ] * \/ ) ? [ a - z 0 - 9 - ~ ] [ a - z 0 - 9 - ._ ~ ] * $ / . test ( projectName )
@@ -75,6 +76,7 @@ async function init() {
75
76
// --with-tests / --tests (equals to `--vitest --cypress`)
76
77
// --vitest
77
78
// --cypress
79
+ // --nightwatch
78
80
// --playwright
79
81
// --eslint
80
82
// --eslint-with-prettier (only support prettier through eslint for simplicity)
@@ -101,6 +103,7 @@ async function init() {
101
103
argv . tests ??
102
104
argv . vitest ??
103
105
argv . cypress ??
106
+ argv . nightwatch ??
104
107
argv . playwright ??
105
108
argv . eslint
106
109
) === 'boolean'
@@ -119,7 +122,7 @@ async function init() {
119
122
needsRouter ? : boolean
120
123
needsPinia ? : boolean
121
124
needsVitest ? : boolean
122
- needsE2eTesting ? : false | 'cypress' | 'playwright'
125
+ needsE2eTesting ? : false | 'cypress' | 'nightwatch' | ' playwright'
123
126
needsEslint ? : boolean
124
127
needsPrettier ? : boolean
125
128
} = { }
@@ -134,6 +137,7 @@ async function init() {
134
137
// - Install Vue Router for SPA development?
135
138
// - Install Pinia for state management?
136
139
// - Add Cypress for testing?
140
+ // - Add Nightwatch for testing?
137
141
// - Add Playwright for end-to-end testing?
138
142
// - Add ESLint for code quality?
139
143
// - Add Prettier for code formatting?
@@ -226,6 +230,13 @@ async function init() {
226
230
: 'also supports unit testing with Cypress Component Testing' ,
227
231
value : 'cypress'
228
232
} ,
233
+ {
234
+ title : 'Nightwatch' ,
235
+ description : answers . needsVitest
236
+ ? undefined
237
+ : 'also supports unit testing with Nightwatch Component Testing' ,
238
+ value : 'nightwatch'
239
+ } ,
229
240
{
230
241
title : 'Playwright' ,
231
242
value : 'playwright'
@@ -283,6 +294,8 @@ async function init() {
283
294
const { needsE2eTesting } = result
284
295
const needsCypress = argv . cypress || argv . tests || needsE2eTesting === 'cypress'
285
296
const needsCypressCT = needsCypress && ! needsVitest
297
+ const needsNightwatch = argv . nightwatch || argv . tests || needsE2eTesting === 'nightwatch'
298
+ const needsNightwatchCT = needsNightwatch && ! needsVitest
286
299
const needsPlaywright = argv . playwright || needsE2eTesting === 'playwright'
287
300
288
301
const root = path . join ( cwd , targetDir )
@@ -329,6 +342,12 @@ async function init() {
329
342
if ( needsCypressCT ) {
330
343
render ( 'config/cypress-ct' )
331
344
}
345
+ if ( needsNightwatch ) {
346
+ render ( 'config/nightwatch' )
347
+ }
348
+ if ( needsNightwatchCT ) {
349
+ render ( 'config/nightwatch-ct' )
350
+ }
332
351
if ( needsPlaywright ) {
333
352
render ( 'config/playwright' )
334
353
}
@@ -349,6 +368,12 @@ async function init() {
349
368
if ( needsVitest ) {
350
369
render ( 'tsconfig/vitest' )
351
370
}
371
+ if ( needsNightwatch ) {
372
+ render ( 'tsconfig/nightwatch' )
373
+ }
374
+ if ( needsNightwatchCT ) {
375
+ render ( 'tsconfig/nightwatch-ct' )
376
+ }
352
377
}
353
378
354
379
// Render ESLint config
@@ -393,7 +418,7 @@ async function init() {
393
418
root ,
394
419
( ) => { } ,
395
420
( filepath ) => {
396
- if ( filepath . endsWith ( '.js' ) ) {
421
+ if ( filepath . endsWith ( '.js' ) && ! FILES_TO_FILTER . includes ( path . basename ( filepath ) ) ) {
397
422
const tsFilePath = filepath . replace ( / \. j s $ / , '.ts' )
398
423
if ( fs . existsSync ( tsFilePath ) ) {
399
424
fs . unlinkSync ( filepath )
@@ -437,7 +462,9 @@ async function init() {
437
462
needsTypeScript,
438
463
needsVitest,
439
464
needsCypress,
465
+ needsNightwatch,
440
466
needsPlaywright,
467
+ needsNightwatchCT,
441
468
needsCypressCT,
442
469
needsEslint
443
470
} )
0 commit comments