cherry-pick(release-1.12): fix @playwright/test plumbing (#6994)
Cherry-pick #6992 SHA 6788b9cf8c
Co-authored-by: Joel Einbinder <joel.einbinder@gmail.com>
This commit is contained in:
parent
0d845e0f82
commit
af4d008e53
|
|
@ -250,8 +250,20 @@ program
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!process.env.PW_CLI_TARGET_LANG) {
|
if (!process.env.PW_CLI_TARGET_LANG) {
|
||||||
if (packageJSON.name === '@playwright/test' || process.env.PWTEST_CLI_ALLOW_TEST_COMMAND) {
|
let playwrightTestPackagePath = null;
|
||||||
require('../test/cli').addTestCommand(program);
|
try {
|
||||||
|
const isLocal = packageJSON.name === '@playwright/test' || process.env.PWTEST_CLI_ALLOW_TEST_COMMAND;
|
||||||
|
if (isLocal) {
|
||||||
|
playwrightTestPackagePath = '../test/cli';
|
||||||
|
} else {
|
||||||
|
playwrightTestPackagePath = require.resolve('@playwright/test/lib/test/cli', {
|
||||||
|
paths: [__dirname, process.cwd()]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
if (playwrightTestPackagePath) {
|
||||||
|
require(playwrightTestPackagePath).addTestCommand(program);
|
||||||
} else {
|
} else {
|
||||||
const command = program.command('test');
|
const command = program.command('test');
|
||||||
command.description('Run tests with Playwright Test. Available in @playwright/test package.');
|
command.description('Run tests with Playwright Test. Available in @playwright/test package.');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue