@@ -8,11 +8,10 @@ const { test, variants, prepareServer } = setupTest({ devtoolsJson } as {
88 devtoolsJson ?: typeof devtoolsJson ;
99} ) ;
1010
11- const kitOnly = variants . filter ( ( v ) => v . includes ( 'kit' ) ) ;
12- test . concurrent . for ( kitOnly ) ( 'default - %s' , async ( variant , { page, ...ctx } ) => {
11+ test . concurrent . for ( variants ) ( 'default - %s' , async ( variant , { page, ...ctx } ) => {
1312 const cwd = await ctx . run ( variant , { devtoolsJson : { } } ) ;
1413
15- const { close } = await prepareServer ( { cwd, page, previewCommand : null ! } ) ;
14+ const { close } = await prepareServer ( { cwd, page } ) ;
1615 // kill server process when we're done
1716 ctx . onTestFinished ( async ( ) => await close ( ) ) ;
1817
@@ -27,3 +26,25 @@ test.concurrent.for(kitOnly)('default - %s', async (variant, { page, ...ctx }) =
2726 // Check if it's called
2827 expect ( viteContent ) . toContain ( `devtoolsJson()` ) ;
2928} ) ;
29+
30+ test . concurrent . for ( variants ) (
31+ 'without selecting the addon specifically - %s' ,
32+ async ( variant , { page, ...ctx } ) => {
33+ const cwd = await ctx . run ( variant , { } ) ;
34+
35+ const { close } = await prepareServer ( { cwd, page } ) ;
36+ // kill server process when we're done
37+ ctx . onTestFinished ( async ( ) => await close ( ) ) ;
38+
39+ const ext = variant . includes ( 'ts' ) ? 'ts' : 'js' ;
40+ const viteFile = path . resolve ( cwd , `vite.config.${ ext } ` ) ;
41+ const viteContent = fs . readFileSync ( viteFile , 'utf8' ) ;
42+
43+ // Check if we have the import part
44+ expect ( viteContent ) . toContain ( `import devtoolsJson from` ) ;
45+ expect ( viteContent ) . toContain ( `vite-plugin-devtools-json` ) ;
46+
47+ // Check if it's called
48+ expect ( viteContent ) . toContain ( `devtoolsJson()` ) ;
49+ }
50+ ) ;
0 commit comments