fix(driver): add external commands only for JS binding (#28968)
Motivation: Before this change if a language binding invoked the CLI with `--help` or without any arguments (which will also show the help text) it was suggesting that test/merge-reports/show-report is something we support. After this change this does not get shown anymore.
This commit is contained in:
parent
8936885a67
commit
808359ba6c
|
|
@ -53,6 +53,7 @@ const kExternalPlaywrightTestCommands = [
|
||||||
['show-report', 'Show Playwright Test HTML report.'],
|
['show-report', 'Show Playwright Test HTML report.'],
|
||||||
['merge-reports', 'Merge Playwright Test Blob reports'],
|
['merge-reports', 'Merge Playwright Test Blob reports'],
|
||||||
];
|
];
|
||||||
|
function addExternalPlaywrightTestCommands() {
|
||||||
for (const [command, description] of kExternalPlaywrightTestCommands) {
|
for (const [command, description] of kExternalPlaywrightTestCommands) {
|
||||||
const playwrightTest = program.command(command).allowUnknownOption(true);
|
const playwrightTest = program.command(command).allowUnknownOption(true);
|
||||||
playwrightTest.description(`${description} Available in @playwright/test package.`);
|
playwrightTest.description(`${description} Available in @playwright/test package.`);
|
||||||
|
|
@ -61,5 +62,9 @@ for (const [command, description] of kExternalPlaywrightTestCommands) {
|
||||||
gracefullyProcessExitDoNotHang(1);
|
gracefullyProcessExitDoNotHang(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!process.env.PW_LANG_NAME)
|
||||||
|
addExternalPlaywrightTestCommands();
|
||||||
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue