From 19715300b35662be0d4dcf89b89b54b9a9d265c8 Mon Sep 17 00:00:00 2001 From: Yevhen Laichenkov Date: Mon, 4 Oct 2021 11:55:29 +0300 Subject: [PATCH] fix(create-playwright): add extra -- for the debug script (#9257) Co-authored-by: Max Schmitt --- packages/create-playwright/src/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 () => {