From fa00abd47d0ff0141466e720e2e3e4c8d9f24e54 Mon Sep 17 00:00:00 2001 From: Liquido Date: Wed, 20 May 2026 16:52:29 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Corre=C3=A7=C3=A3o=20do=20comando=20yarn=20?= =?UTF-8?q?init?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fontes/interface-linha-comando/novo/index.ts | 2 +- testes/liquido.test.ts | 25 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/fontes/interface-linha-comando/novo/index.ts b/fontes/interface-linha-comando/novo/index.ts index 999f38f..e1d7a73 100644 --- a/fontes/interface-linha-comando/novo/index.ts +++ b/fontes/interface-linha-comando/novo/index.ts @@ -108,7 +108,7 @@ export async function detectarGerenciadorDePacotes( break; } case 'yarn': { - execSync('yarn init', { cwd: diretorioProjeto }); + execSync('yarn init -2 -y', { cwd: diretorioProjeto }); execSync('yarn add liquido@latest', { cwd: diretorioProjeto }); break; } diff --git a/testes/liquido.test.ts b/testes/liquido.test.ts index 8de951b..276e6ae 100644 --- a/testes/liquido.test.ts +++ b/testes/liquido.test.ts @@ -337,6 +337,31 @@ describe('Liquido', () => { ); }); + + it('Deve executar os comandos do yarn para inicializar o projeto', async () => { + jest.clearAllMocks(); + + (ChildProcess.execSync as jest.Mock).mockImplementation( + () => Buffer.from('') + ); + + await detectarGerenciadorDePacotes( + 'yarn', + caminhoDiretorioProjeto + ); + + expect(ChildProcess.execSync).toHaveBeenCalledWith( + 'yarn init -2 -y', + { cwd: caminhoDiretorioProjeto } + ); + expect(ChildProcess.execSync).toHaveBeenCalledWith( + 'yarn add liquido@latest', + { cwd: caminhoDiretorioProjeto } + ); + + }); + + it('Deve usar o nome da pasta quando o nome do projeto é criado com "." ou "./"', async () => { const spyCwd = jest From 35a2d2cf8bae03919ada760f75f967c99a48fcb6 Mon Sep 17 00:00:00 2001 From: Liquido Date: Thu, 21 May 2026 08:41:02 -0300 Subject: [PATCH 2/2] Altera comando yarn --- fontes/interface-linha-comando/novo/index.ts | 2 +- testes/liquido.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fontes/interface-linha-comando/novo/index.ts b/fontes/interface-linha-comando/novo/index.ts index e1d7a73..2c31801 100644 --- a/fontes/interface-linha-comando/novo/index.ts +++ b/fontes/interface-linha-comando/novo/index.ts @@ -108,7 +108,7 @@ export async function detectarGerenciadorDePacotes( break; } case 'yarn': { - execSync('yarn init -2 -y', { cwd: diretorioProjeto }); + execSync('yarn init -y', { cwd: diretorioProjeto }); execSync('yarn add liquido@latest', { cwd: diretorioProjeto }); break; } diff --git a/testes/liquido.test.ts b/testes/liquido.test.ts index 276e6ae..4ff5088 100644 --- a/testes/liquido.test.ts +++ b/testes/liquido.test.ts @@ -351,7 +351,7 @@ describe('Liquido', () => { ); expect(ChildProcess.execSync).toHaveBeenCalledWith( - 'yarn init -2 -y', + 'yarn init -y', { cwd: caminhoDiretorioProjeto } ); expect(ChildProcess.execSync).toHaveBeenCalledWith(