chore: delete --attachments option from merge-reports command (#24350)

We recommend uploading all resources along with the generated report. If
need be we'll reconsider adding the option later.
This commit is contained in:
Yury Semikhatsky 2023-07-21 13:15:00 -07:00 committed by GitHub
parent d307c8e63a
commit 6a3721eb9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View File

@ -88,8 +88,6 @@ Examples:
$ npx playwright show-report playwright-report`);
}
const kAttachmentModes: string[] = ['local', 'missing'];
function addMergeReportsCommand(program: Command) {
const command = program.command('merge-reports [dir]', { hidden: true });
command.description('merge multiple blob reports (for sharded tests) into a single report');
@ -103,7 +101,6 @@ 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('--attachments <mode>', `Whether the attachments are available locally. Supported values are ${kAttachmentModes.map(name => `"${name}"`).join(', ')} (default: "local")`);
command.addHelpText('afterAll', `
Arguments [dir]:
Directory containing blob reports.
@ -200,12 +197,7 @@ async function mergeReports(reportDir: string | undefined, opts: { [key: string]
reporterDescriptions = config.config.reporter;
if (!reporterDescriptions)
reporterDescriptions = [[defaultReporter]];
if (opts.attachments) {
if (!kAttachmentModes.includes(opts.attachments))
throw new Error(`Invalid --attachments value "${opts.attachments}", must be one of ${kAttachmentModes.map(name => `"${name}"`).join(', ')}.`);
}
const resolveAttachmentPaths = opts.attachments !== 'missing';
await createMergedReport(config, dir, reporterDescriptions!, resolveAttachmentPaths);
await createMergedReport(config, dir, reporterDescriptions!);
}
function overridesFromOptions(options: { [key: string]: any }): ConfigCLIOverrides {

View File

@ -26,13 +26,12 @@ import { Multiplexer } from './multiplexer';
import { ZipFile } from 'playwright-core/lib/utils';
import type { BlobReportMetadata } from './blob';
export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[], resolvePaths: boolean) {
export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[]) {
const shardFiles = await sortedShardFiles(dir);
if (shardFiles.length === 0)
throw new Error(`No report files found in ${dir}`);
const events = await mergeEvents(dir, shardFiles);
if (resolvePaths)
patchAttachmentPaths(events, dir);
patchAttachmentPaths(events, dir);
const reporters = await createReporters(config, 'merge', reporterDescriptions);
const receiver = new TeleReporterReceiver(path.sep, new Multiplexer(reporters), false, config.config);

View File

@ -495,7 +495,7 @@ test('generate html with attachment urls', async ({ runInlineTest, mergeReports,
const reportFiles = await fs.promises.readdir(reportDir);
reportFiles.sort();
expect(reportFiles).toEqual([expect.stringMatching(/report-.*.zip/), 'resources']);
const { exitCode } = await mergeReports(reportDir, { 'PW_TEST_HTML_REPORT_OPEN': 'never' }, { additionalArgs: ['--reporter', 'html', '--attachments', 'missing'] });
const { exitCode } = await mergeReports(reportDir, { 'PW_TEST_HTML_REPORT_OPEN': 'never' }, { additionalArgs: ['--reporter', 'html'] });
expect(exitCode).toBe(0);
const htmlReportDir = test.info().outputPath('playwright-report');