@@ -104,6 +104,11 @@ function getFramework(): prompt.Choice[] {
104
104
value : 'marko' ,
105
105
description : '"A declarative, HTML-based language that makes building web apps fun"' ,
106
106
} ,
107
+ {
108
+ title : 'qwik' ,
109
+ value : 'qwik' ,
110
+ description : '"Instantly interactive web apps at scale"' ,
111
+ } ,
107
112
]
108
113
}
109
114
@@ -125,6 +130,8 @@ function getFrameworkTestPackage(framework: string) {
125
130
return '@solidjs/testing-library'
126
131
case 'marko' :
127
132
return '@marko/testing-library'
133
+ case 'qwik' :
134
+ return 'vitest-browser-qwik'
128
135
}
129
136
throw new Error ( `Unsupported framework: ${ framework } ` )
130
137
}
@@ -143,6 +150,8 @@ function getFrameworkPluginPackage(framework: string) {
143
150
return 'vite-plugin-solid'
144
151
case 'marko' :
145
152
return '@marko/vite'
153
+ case 'qwik' :
154
+ return '@builder.io/qwik/optimizer'
146
155
}
147
156
return null
148
157
}
@@ -224,6 +233,9 @@ function getPossibleFramework(dependencies: Record<string, string>) {
224
233
if ( dependencies . marko ) {
225
234
return 'marko'
226
235
}
236
+ if ( dependencies [ '@builder.io/qwik' ] || dependencies [ '@qwik.dev/core' ] ) {
237
+ return 'qwik'
238
+ }
227
239
return 'vanilla'
228
240
}
229
241
@@ -257,22 +269,36 @@ function fail() {
257
269
process . exitCode = 1
258
270
}
259
271
272
+ function getFrameworkImportInfo ( framework : string ) {
273
+ switch ( framework ) {
274
+ case 'svelte' :
275
+ return { importName : 'svelte' , isNamedExport : true }
276
+ case 'qwik' :
277
+ return { importName : 'qwikVite' , isNamedExport : true }
278
+ default :
279
+ return { importName : framework , isNamedExport : false }
280
+ }
281
+ }
282
+
260
283
async function generateFrameworkConfigFile ( options : {
261
284
configPath : string
262
285
framework : string
263
286
frameworkPlugin : string | null
264
287
provider : string
265
288
browsers : string [ ]
266
289
} ) {
267
- const frameworkImport = options . framework === 'svelte'
268
- ? `import { svelte } from '${ options . frameworkPlugin } '`
269
- : `import ${ options . framework } from '${ options . frameworkPlugin } '`
290
+ const { importName, isNamedExport } = getFrameworkImportInfo ( options . framework )
291
+
292
+ const frameworkImport = isNamedExport
293
+ ? `import { ${ importName } } from '${ options . frameworkPlugin } '`
294
+ : `import ${ importName } from '${ options . frameworkPlugin } '`
295
+
270
296
const configContent = [
271
297
`import { defineConfig } from 'vitest/config'` ,
272
298
options . frameworkPlugin ? frameworkImport : null ,
273
299
`` ,
274
300
'export default defineConfig({' ,
275
- options . frameworkPlugin ? ` plugins: [${ options . framework } ()],` : null ,
301
+ options . frameworkPlugin ? ` plugins: [${ importName } ()],` : null ,
276
302
` test: {` ,
277
303
` browser: {` ,
278
304
` enabled: true,` ,
0 commit comments