fix --last-run-file parameter

This commit is contained in:
Mathias Leppich 2024-09-11 18:59:24 +02:00
parent eb25f3cfe4
commit 16b39b8118
2 changed files with 6 additions and 4 deletions

View file

@ -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 {

View file

@ -145,6 +145,7 @@ function addMergeReportsCommand(program: Command) {
});
command.option('-c, --config <file>', `Configuration file. Can be used to specify additional configuration for the output report.`);
command.option('--reporter <reporter>', `Reporter to use, comma-separated, can be ${builtInReporters.map(name => `"${name}"`).join(', ')} (default: "${defaultReporter}")`);
command.option('--last-run-file <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 <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 <N>', `Stop after the first N failures`],
['--no-deps', 'Do not run project dependencies'],