diff --git a/packages/playwright/src/common/configLoader.ts b/packages/playwright/src/common/configLoader.ts index 9edca1a95f..315ddde670 100644 --- a/packages/playwright/src/common/configLoader.ts +++ b/packages/playwright/src/common/configLoader.ts @@ -346,9 +346,9 @@ export async function loadConfigFromFileRestartIfNeeded(configFile: string | und return await loadConfig(location, overrides, ignoreDeps); } -export async function loadEmptyConfigForMergeReports() { +export async function loadEmptyConfigForMergeReports(overrides?: ConfigCLIOverrides) { // Merge reports is "different" for no good reason. It should not pick up local config from the cwd. - return await loadConfig({ configDir: process.cwd() }); + return await loadConfig({ configDir: process.cwd() }, overrides); } export function restartWithExperimentalTsEsm(configFile: string | undefined, force: boolean = false): boolean { diff --git a/packages/playwright/src/program.ts b/packages/playwright/src/program.ts index b3410df9f0..c68bc15b07 100644 --- a/packages/playwright/src/program.ts +++ b/packages/playwright/src/program.ts @@ -145,6 +145,7 @@ function addMergeReportsCommand(program: Command) { }); command.option('-c, --config ', `Configuration file. Can be used to specify additional configuration for the output report.`); command.option('--reporter ', `Reporter to use, comma-separated, can be ${builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${defaultReporter}")`); + command.option('--last-run-file ', `Path to a json file where the last run information is written to (default: test-results/.last-run.json)`); command.addHelpText('afterAll', ` Arguments [dir]: Directory containing blob reports. @@ -272,7 +273,8 @@ async function listTestFiles(opts: { [key: string]: any }) { async function mergeReports(reportDir: string | undefined, opts: { [key: string]: any }) { const configFile = opts.config; - const config = configFile ? await loadConfigFromFileRestartIfNeeded(configFile) : await loadEmptyConfigForMergeReports(); + const cliOverrides = overridesFromOptions(opts); + const config = configFile ? await loadConfigFromFileRestartIfNeeded(configFile, cliOverrides) : await loadEmptyConfigForMergeReports(cliOverrides); if (!config) return; @@ -382,7 +384,7 @@ const testOptions: [string, string][] = [ ['--headed', `Run tests in headed browsers (default: headless)`], ['--ignore-snapshots', `Ignore screenshot and snapshot expectations`], ['--last-failed', `Only re-run the failures`], - ['--last-run-file', `Path to a json file where the last run information is read from and written to (default: test-results/.last-run.json)`], + ['--last-run-file ', `Path to a json file where the last run information is read from and written to (default: test-results/.last-run.json)`], ['--list', `Collect all the tests and report them, but do not run`], ['--max-failures ', `Stop after the first N failures`], ['--no-deps', 'Do not run project dependencies'],