Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Max Schmitt29fbcbee69de
diff --git a/packages/playwright-core/src/cli/cli.ts b/packages/playwright-core/src/cli/cli.ts
index ac3cacff9d..7286f2f837 100755
--- a/packages/playwright-core/src/cli/cli.ts
+++ b/packages/playwright-core/src/cli/cli.ts
@@ -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);
});
}