fix: warn if PWT commands get executed without PWT (#26542)

Fixes https://github.com/microsoft/playwright/issues/26541
This commit is contained in:
Max Schmitt 2023-08-18 18:26:34 +02:00 committed by GitHub
parent e15db7993a
commit 29fbcbee69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,20 +48,16 @@ function printPlaywrightTestError(command: string) {
}
}
{
const command = program.command('test').allowUnknownOption(true);
command.description('Run tests with Playwright Test. Available in @playwright/test package.');
command.action(async () => {
printPlaywrightTestError('test');
gracefullyProcessExitDoNotHang(1);
});
}
{
const command = program.command('show-report').allowUnknownOption(true);
command.description('Show Playwright Test HTML report. Available in @playwright/test package.');
command.action(async () => {
printPlaywrightTestError('show-report');
const kExternalPlaywrightTestCommands = [
['test', 'Run tests with Playwright Test.'],
['show-report', 'Show Playwright Test HTML report.'],
['merge-reports', 'Merge Playwright Test Blob reports'],
];
for (const [command, description] of kExternalPlaywrightTestCommands) {
const playwrightTest = program.command(command).allowUnknownOption(true);
playwrightTest.description(`${description} Available in @playwright/test package.`);
playwrightTest.action(async () => {
printPlaywrightTestError(command);
gracefullyProcessExitDoNotHang(1);
});
}