Skip to content

Commit

Permalink
Use try/catch instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdctaka committed Jun 18, 2023
1 parent 2ee914f commit eebc772
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions src/test/suite/commands/configureProjectCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 "[email protected]"'
'git config --global user.email'
);
if (emailResult.stderr !== '') {
try {
await CommonUtils.executeCommandAsync(
//'git config --global user.email "[email protected]"'
'git config --global user.email'
);
} catch {
console.error('fff');
await CommonUtils.executeCommandAsync(
'git config --global user.email "[email protected]'
);
}

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 "[email protected]'
// );
// }

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"'
Expand Down

0 comments on commit eebc772

Please sign in to comment.