@@ -508,6 +508,30 @@ describe("create-webpack-app cli", () => {
508508 expect ( readFromWebpackConfig ( dir ) ) . toMatchSnapshot ( ) ;
509509 } ) ;
510510
511+ it ( "should generate react template with typescript" , async ( ) => {
512+ const { stdout } = await runPromptWithAnswers (
513+ dir ,
514+ [ "init" , "." , "--template=react" ] ,
515+ [ `${ DOWN } ${ ENTER } ` , `y${ ENTER } ` , `y${ ENTER } ` , ENTER , `y${ ENTER } ` , ENTER , ENTER , ENTER ] ,
516+ ) ;
517+
518+ expect ( stdout ) . toContain ( "Project has been initialised with webpack!" ) ;
519+ expect ( stdout ) . toContain ( "webpack.config.ts" ) ;
520+
521+ const files = [
522+ ...reactTemplateFiles . filter ( ( file ) => file !== "webpack.config.js" ) ,
523+ "webpack.config.ts" ,
524+ "tsconfig.json" ,
525+ ] ;
526+
527+ for ( const file of files ) {
528+ expect ( existsSync ( resolve ( dir , file ) ) ) . toBeTruthy ( ) ;
529+ }
530+
531+ expect ( readFromPkgJSON ( dir ) ) . toMatchSnapshot ( ) ;
532+ expect ( readFromWebpackConfig ( dir , "webpack.config.ts" ) ) . toMatchSnapshot ( ) ;
533+ } ) ;
534+
511535 it ( "should generate vue template with store and router support on prompt answers" , async ( ) => {
512536 const { stdout } = await runPromptWithAnswers (
513537 dir ,
@@ -532,6 +556,30 @@ describe("create-webpack-app cli", () => {
532556 expect ( readFromWebpackConfig ( dir ) ) . toMatchSnapshot ( ) ;
533557 } ) ;
534558
559+ it ( "should generate vue template with typescript" , async ( ) => {
560+ const { stdout } = await runPromptWithAnswers (
561+ dir ,
562+ [ "init" , "." , "--template=vue" ] ,
563+ [ `${ DOWN } ${ ENTER } ` , `y${ ENTER } ` , `y${ ENTER } ` , ENTER , `y${ ENTER } ` , ENTER , ENTER , ENTER ] ,
564+ ) ;
565+
566+ expect ( stdout ) . toContain ( "Project has been initialised with webpack!" ) ;
567+ expect ( stdout ) . toContain ( "webpack.config.ts" ) ;
568+
569+ const files = [
570+ ...vueTemplateFiles . filter ( ( file ) => file !== "webpack.config.js" ) ,
571+ "webpack.config.ts" ,
572+ "tsconfig.json" ,
573+ ] ;
574+
575+ for ( const file of files ) {
576+ expect ( existsSync ( resolve ( dir , file ) ) ) . toBeTruthy ( ) ;
577+ }
578+
579+ expect ( readFromPkgJSON ( dir ) ) . toMatchSnapshot ( ) ;
580+ expect ( readFromWebpackConfig ( dir , "webpack.config.ts" ) ) . toMatchSnapshot ( ) ;
581+ } ) ;
582+
535583 it ( "should generate svelte template with prompt answers" , async ( ) => {
536584 const { stdout } = await runPromptWithAnswers (
537585 dir ,
@@ -553,4 +601,28 @@ describe("create-webpack-app cli", () => {
553601 // Check if the generated webpack configuration matches the snapshot
554602 expect ( readFromWebpackConfig ( dir ) ) . toMatchSnapshot ( ) ;
555603 } ) ;
604+
605+ it ( "should generate svelte template with typescript" , async ( ) => {
606+ const { stdout } = await runPromptWithAnswers (
607+ dir ,
608+ [ "init" , "." , "--template=svelte" ] ,
609+ [ `${ DOWN } ${ ENTER } ` , `y${ ENTER } ` , `y${ ENTER } ` , ENTER , `y${ ENTER } ` , ENTER , ENTER , ENTER ] ,
610+ ) ;
611+
612+ expect ( stdout ) . toContain ( "Project has been initialised with webpack!" ) ;
613+ expect ( stdout ) . toContain ( "webpack.config.ts" ) ;
614+
615+ const files = [
616+ ...svelteTemplateFiles . filter ( ( file ) => file !== "webpack.config.js" ) ,
617+ "webpack.config.ts" ,
618+ "tsconfig.json" ,
619+ ] ;
620+
621+ for ( const file of files ) {
622+ expect ( existsSync ( resolve ( dir , file ) ) ) . toBeTruthy ( ) ;
623+ }
624+
625+ expect ( readFromPkgJSON ( dir ) ) . toMatchSnapshot ( ) ;
626+ expect ( readFromWebpackConfig ( dir , "webpack.config.ts" ) ) . toMatchSnapshot ( ) ;
627+ } ) ;
556628} ) ;
0 commit comments