Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/create-playwright/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 () => {
Expand Down