@@ -6,7 +6,6 @@ import fs from 'fs'
6
6
import path from 'path'
7
7
8
8
import type { DataContext } from '..'
9
- import { getDefaultSpecPatterns } from '../util/config-options'
10
9
11
10
interface WizardGetCodeComponent {
12
11
chosenLanguage : CodeLanguage
@@ -144,6 +143,7 @@ export class WizardActions {
144
143
}
145
144
146
145
private async scaffoldConfig ( configCode : string ) : Promise < NexusGenObjects [ 'ScaffoldedFile' ] > {
146
+ this . ctx . lifecycleManager . setConfigFilePath ( this . ctx . coreData . wizard . chosenLanguage )
147
147
if ( ! fs . existsSync ( this . ctx . lifecycleManager . configFilePath ) ) {
148
148
return this . scaffoldFile (
149
149
this . ctx . lifecycleManager . configFilePath ,
@@ -196,9 +196,7 @@ export class WizardActions {
196
196
codeBlocks . push ( lang === 'ts' ? `import { defineConfig } from 'cypress'` : `const { defineConfig } = require('cypress')` )
197
197
codeBlocks . push ( '' )
198
198
codeBlocks . push ( lang === 'ts' ? `export default defineConfig({` : `module.exports = defineConfig({` )
199
- codeBlocks . push ( ` ${ E2E_SCAFFOLD_BODY ( {
200
- lang,
201
- } ) . replace ( / \n / g, '\n ' ) } `)
199
+ codeBlocks . push ( ` ${ E2E_SCAFFOLD_BODY . replace ( / \n / g, '\n ' ) } ` )
202
200
203
201
codeBlocks . push ( '})\n' )
204
202
@@ -212,7 +210,7 @@ export class WizardActions {
212
210
codeBlocks . push ( chosenLanguage . type === 'ts' ? `import { defineConfig } from 'cypress'` : `const { defineConfig } = require('cypress')` )
213
211
codeBlocks . push ( '' )
214
212
codeBlocks . push ( chosenLanguage . type === 'ts' ? `export default defineConfig({` : `module.exports = defineConfig({` )
215
- codeBlocks . push ( `// Component testing, ${ chosenLanguage . name } , ${ chosenFramework . name } , ${ chosenBundler . name } ` )
213
+ codeBlocks . push ( ` // Component testing, ${ chosenLanguage . name } , ${ chosenFramework . name } , ${ chosenBundler . name } ` )
216
214
217
215
codeBlocks . push ( ` ${ COMPONENT_SCAFFOLD_BODY ( {
218
216
lang : chosenLanguage . type ,
@@ -319,23 +317,13 @@ export class WizardActions {
319
317
}
320
318
}
321
319
322
- interface E2eScaffoldOpts {
323
- lang : CodeLanguageEnum
324
- }
325
-
326
- const E2E_SCAFFOLD_BODY = ( opts : E2eScaffoldOpts ) => {
327
- return dedent `
320
+ const E2E_SCAFFOLD_BODY = dedent `
328
321
e2e: {
329
- supportFile: 'cypress/support/e2e.${ opts . lang } ',
330
- specPattern: '${ getDefaultSpecPatterns ( ) . e2e } ',
331
- viewportHeight: 660,
332
- viewportWidth: 1000,
333
322
setupNodeEvents(on, config) {
334
323
// implement node event listeners here
335
324
},
336
325
},
337
- `
338
- }
326
+ `
339
327
340
328
interface ComponentScaffoldOpts {
341
329
lang : CodeLanguageEnum
@@ -346,13 +334,11 @@ interface ComponentScaffoldOpts {
346
334
347
335
const COMPONENT_SCAFFOLD_BODY = ( opts : ComponentScaffoldOpts ) => {
348
336
return dedent `
349
- component: {
350
- supportFile: 'cypress/support/component.${ opts . lang } ',
351
- specPattern: '${ getDefaultSpecPatterns ( ) . component } ',
352
- devServer: import('${ opts . requirePath } '),
353
- devServerConfig: ${ opts . configOptionsString }
354
- },
355
- `
337
+ component: {
338
+ devServer: import('${ opts . requirePath } '),
339
+ devServerConfig: ${ opts . configOptionsString }
340
+ },
341
+ `
356
342
}
357
343
358
344
const FIXTURE_DATA = {
0 commit comments