From f4d7ca075381b4923d2e841439b01c926cc01710 Mon Sep 17 00:00:00 2001 From: Takashi Arai Date: Sat, 17 Jun 2023 20:35:56 -0700 Subject: [PATCH] Check user name and email before git commit. --- .../commands/configureProjectCommand.test.ts | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/test/suite/commands/configureProjectCommand.test.ts b/src/test/suite/commands/configureProjectCommand.test.ts index 8e10f89..5fe0297 100644 --- a/src/test/suite/commands/configureProjectCommand.test.ts +++ b/src/test/suite/commands/configureProjectCommand.test.ts @@ -113,15 +113,32 @@ suite('Configure Project Command Test Suite', () => { await CommonUtils.executeCommandAsync('git init'); await writeFile(path.join(process.cwd(), 'README.txt'), 'Some content'); await CommonUtils.executeCommandAsync('git add README.txt'); - await CommonUtils.executeCommandAsync( - 'git config --global user.email "you@example.com"' + + const emailResult = await CommonUtils.executeCommandAsync( + //'git config --global user.email "you@example.com"' + 'git config --global user.email' ); - await CommonUtils.executeCommandAsync( - 'git config --global user.name "Your Name"' + if (emailResult.stderr !== '') { + 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 !== '') { + console.error('ggg'); + await CommonUtils.executeCommandAsync( + 'git config --global user.name "Your Name"' + ); + } + await CommonUtils.executeCommandAsync( 'git commit --no-gpg-sign -m "Initial commit"' ); + process.chdir(origCwd); try {