@@ -381,10 +381,6 @@ describe('project.js', () => {
381381
382382 expect ( shell . mkdir ) . toHaveBeenCalledWith ( '-p' , 'test-project' ) ;
383383 expect ( shell . cd ) . toHaveBeenCalledWith ( 'test-project' ) ;
384- expect ( spawnSync ) . toHaveBeenCalledWith ( 'npx' , [ 'sv' , 'create' , 'ui' ] , {
385- stdio : 'inherit' ,
386- shell : true ,
387- } ) ;
388384 expect ( shell . cd ) . toHaveBeenCalledWith ( 'contracts' ) ;
389385 checkUiProjectSetup ( shell . exec . mock . calls ) ;
390386 checkIfProjectSetupSuccessful ( ) ;
@@ -661,6 +657,7 @@ describe('project.js', () => {
661657
662658 describe ( 'scaffoldSvelte()' , ( ) => {
663659 it ( 'should set up a SvelteKit project' , async ( ) => {
660+ delete process . env . CI ;
664661 fs . existsSync . mockReturnValue ( false ) ;
665662 shell . cp . mockReturnValue ( true ) ;
666663 fs . readFileSync . mockImplementation ( ( path ) => {
@@ -682,6 +679,46 @@ describe('project.js', () => {
682679 shell : true ,
683680 } ) ;
684681 expect ( fs . writeFileSync ) . toHaveBeenCalled ( ) ;
682+ process . env . CI = true ;
683+ } ) ;
684+
685+ it ( 'should set up a SvelteKit project in non-interactive mode' , async ( ) => {
686+ process . env . ZKAPP_CLI_INTEGRATION_TEST = 'true' ;
687+ fs . existsSync . mockReturnValue ( false ) ;
688+ shell . cp . mockReturnValue ( true ) ;
689+ fs . readFileSync . mockImplementation ( ( path ) => {
690+ if ( path . includes ( 'tsconfig.json' ) ) {
691+ return 'tsconfig.json content' ;
692+ }
693+ return '' ;
694+ } ) ;
695+ fs . writeFileSync . mockImplementation ( ( ) => { } ) ;
696+ fs . copySync . mockReturnValue ( true ) ;
697+ fs . mkdirsSync . mockReturnValue ( true ) ;
698+ fs . emptyDirSync . mockReturnValue ( true ) ;
699+ const { scaffoldSvelte } = await import ( './project.js' ) ;
700+
701+ scaffoldSvelte ( ) ;
702+
703+ expect ( spawnSync ) . toHaveBeenCalledWith (
704+ 'npx' ,
705+ [
706+ 'sv' ,
707+ 'create' ,
708+ '--template' ,
709+ 'minimal' ,
710+ '--types' ,
711+ 'ts' ,
712+ '--no-add-ons' ,
713+ 'ui' ,
714+ ] ,
715+ {
716+ stdio : 'inherit' ,
717+ shell : true ,
718+ }
719+ ) ;
720+ expect ( fs . writeFileSync ) . toHaveBeenCalled ( ) ;
721+ delete process . env . ZKAPP_CLI_INTEGRATION_TEST ;
685722 } ) ;
686723 } ) ;
687724
0 commit comments