Skip to content

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

fix(create-playwright): add extra -- for the debug script (#9257)

Yevhen Laichenkov19715300b356
diff --git a/packages/create-playwright/src/index.ts b/packages/create-playwright/src/index.ts
index f7806ab8e2..d74e2aac60 100755
--- a/packages/create-playwright/src/index.ts
+++ b/packages/create-playwright/src/index.ts
@@ -159,13 +159,13 @@ class Generator {
${colors.cyan(commandToRunTests(this.packageManager))}
Runs the end-to-end tests.
- ${colors.cyan(commandToRunTests(this.packageManager) + ' -- --project="Desktop Chrome"')}
+ ${colors.cyan(commandToRunTests(this.packageManager, '--project="Desktop Chrome"'))}
Runs the tests only on Desktop Chrome.
- ${colors.cyan(commandToRunTests(this.packageManager) + ` -- ${exampleSpecPath}`)}
+ ${colors.cyan(commandToRunTests(this.packageManager, exampleSpecPath))}
Runs the tests of a specific file.
-
- ${colors.cyan(`${commandToRunTests(this.packageManager)} --debug`)}
+
+ ${colors.cyan(`${commandToRunTests(this.packageManager, '--debug')}`)}
Runs the tests in debug mode.
We suggest that you begin by typing:
@@ -182,10 +182,10 @@ Happy hacking! 🎭`);
}
}
-export function commandToRunTests(packageManager: 'npm' | 'yarn') {
+export function commandToRunTests(packageManager: 'npm' | 'yarn', args?: string) {
if (packageManager === 'yarn')
- return `yarn ${PACKAGE_JSON_TEST_SCRIPT_CMD}`;
- return `npm run ${PACKAGE_JSON_TEST_SCRIPT_CMD}`;
+ return `yarn ${PACKAGE_JSON_TEST_SCRIPT_CMD}${args ? (' ' + args) : ''}`;
+ return `npm run ${PACKAGE_JSON_TEST_SCRIPT_CMD}${args ? (' -- ' + args) : ''}`;
}
(async () => {