Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fontes/interface-linha-comando/novo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function detectarGerenciadorDePacotes(
break;
}
case 'yarn': {
execSync('yarn init', { cwd: diretorioProjeto });
execSync('yarn init -y', { cwd: diretorioProjeto });
execSync('yarn add liquido@latest', { cwd: diretorioProjeto });
break;
}
Expand Down
25 changes: 25 additions & 0 deletions testes/liquido.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 -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
Expand Down
Loading