@@ -370,6 +370,70 @@ describe('Liquido', () => {
370370 ) ;
371371
372372 } ) ;
373+
374+ it ( 'Deve inicializar projeto com Bun sem criar arquivos desnecessários' , async ( ) => {
375+ jest . clearAllMocks ( ) ;
376+ const caminhoDiretorioBun = caminho . join (
377+ process . cwd ( ) ,
378+ 'teste-comando-novo-bun'
379+ ) ;
380+
381+ ( ChildProcess . execSync as jest . Mock ) . mockImplementation (
382+ ( ) => Buffer . from ( '' )
383+ ) ;
384+
385+ await sistemaArquivos . promises . rm (
386+ caminhoDiretorioBun ,
387+ { recursive : true , force : true }
388+ ) ;
389+ await sistemaArquivos . promises . mkdir ( caminhoDiretorioBun ) ;
390+
391+ try {
392+ await detectarGerenciadorDePacotes (
393+ 'bun' ,
394+ caminhoDiretorioBun
395+ ) ;
396+
397+ const conteudoPackageJson = JSON . parse (
398+ await sistemaArquivos . promises . readFile (
399+ `${ caminhoDiretorioBun } /package.json` ,
400+ 'utf-8'
401+ )
402+ ) ;
403+
404+ expect ( ChildProcess . execSync ) . not . toHaveBeenCalledWith (
405+ 'bun init -y' ,
406+ { cwd : caminhoDiretorioBun }
407+ ) ;
408+ expect ( ChildProcess . execSync ) . toHaveBeenCalledWith (
409+ 'bun add liquido@latest' ,
410+ { cwd : caminhoDiretorioBun }
411+ ) ;
412+ expect ( conteudoPackageJson ) . toMatchObject ( {
413+ name : 'teste-comando-novo-bun' ,
414+ version : '1.0.0' ,
415+ private : true ,
416+ dependencies : { }
417+ } ) ;
418+ expect ( conteudoPackageJson ) . not . toHaveProperty (
419+ 'peerDependencies.typescript'
420+ ) ;
421+ expect (
422+ sistemaArquivos . existsSync ( `${ caminhoDiretorioBun } /tsconfig.json` )
423+ ) . toBeFalsy ( ) ;
424+ expect (
425+ sistemaArquivos . existsSync ( `${ caminhoDiretorioBun } /index.ts` )
426+ ) . toBeFalsy ( ) ;
427+ expect (
428+ sistemaArquivos . existsSync ( `${ caminhoDiretorioBun } /README.md` )
429+ ) . toBeFalsy ( ) ;
430+ } finally {
431+ await sistemaArquivos . promises . rm (
432+ caminhoDiretorioBun ,
433+ { recursive : true , force : true }
434+ ) ;
435+ }
436+ } ) ;
373437
374438
375439 it ( 'Deve usar o nome da pasta quando o nome do projeto é criado com "." ou "./"' , async ( ) => {
0 commit comments