Upon reviewing some typescript code, I noticed the presence of extra curly braces within an else block. Are these additional braces serving a specific purpose or are they simply used to provide further grouping for two nearly identical code snippets? Considering this originates from a highly popular Microsoft repository, it seems unlikely to be accidental.
if (playwrightTestPackagePath) {
require(playwrightTestPackagePath).addTestCommand(program);
require(playwrightTestPackagePath).addShowReportCommand(program);
require(playwrightTestPackagePath).addListFilesCommand(program);
} else {
{
const command = program.command('test').allowUnknownOption(true);
command.description('Run tests with Playwright Test. Available in @playwright/test package.');
command.action(async () => {
console.error('Please install @playwright/test package to use Playwright Test.');
console.error(' npm install -D @playwright/test');
process.exit(1);
});
}
{
const command = program.command('show-report').allowUnknownOption(true);
command.description('Show Playwright Test HTML report. Available in @playwright/test package.');
command.action(async () => {
console.error('Please install @playwright/test package to use Playwright Test.');
console.error(' npm install -D @playwright/test');
process.exit(1);
});
}
}
}