From eebc7726f8d75564a02710e9b300d030489a54a2 Mon Sep 17 00:00:00 2001 From: Takashi Arai Date: Sat, 17 Jun 2023 20:41:47 -0700 Subject: [PATCH] Use try/catch instead. --- .../commands/configureProjectCommand.test.ts | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/test/suite/commands/configureProjectCommand.test.ts b/src/test/suite/commands/configureProjectCommand.test.ts index 386d3b5..3cb8965 100644 --- a/src/test/suite/commands/configureProjectCommand.test.ts +++ b/src/test/suite/commands/configureProjectCommand.test.ts @@ -114,26 +114,44 @@ suite('Configure Project Command Test Suite', () => { await writeFile(path.join(process.cwd(), 'README.txt'), 'Some content'); await CommonUtils.executeCommandAsync('git add README.txt'); - const emailResult = await CommonUtils.executeCommandAsync( - //'git config --global user.email "you@example.com"' - 'git config --global user.email' - ); - if (emailResult.stderr !== '') { + try { + await CommonUtils.executeCommandAsync( + //'git config --global user.email "you@example.com"' + 'git config --global user.email' + ); + } catch { console.error('fff'); await CommonUtils.executeCommandAsync( 'git config --global user.email "you@example.com' ); } - const nameResult = await CommonUtils.executeCommandAsync( - 'git config --global user.name' - ); - if (nameResult.stderr !== '') { + // if (emailResult.stderr !== '') { + // console.error('fff'); + // await CommonUtils.executeCommandAsync( + // 'git config --global user.email "you@example.com' + // ); + // } + + try { + await CommonUtils.executeCommandAsync( + 'git config --global user.name' + ); + } catch { console.error('ggg'); await CommonUtils.executeCommandAsync( 'git config --global user.name "Your Name"' ); } + // const nameResult = await CommonUtils.executeCommandAsync( + // 'git config --global user.name' + // ); + // if (nameResult.stderr !== '') { + // console.error('ggg'); + // await CommonUtils.executeCommandAsync( + // 'git config --global user.name "Your Name"' + // ); + // } await CommonUtils.executeCommandAsync( 'git commit --no-gpg-sign -m "Initial commit"'