Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: clear message for no reports (#23492)

Yury Semikhatskyceaa29cec1d1
diff --git a/packages/playwright-test/src/reporters/merge.ts b/packages/playwright-test/src/reporters/merge.ts
index a7041e9849..f67b4fd243 100644
--- a/packages/playwright-test/src/reporters/merge.ts
+++ b/packages/playwright-test/src/reporters/merge.ts
@@ -26,6 +26,8 @@ import { Multiplexer } from './multiplexer';
export async function createMergedReport(config: FullConfigInternal, dir: string, reporterDescriptions: ReporterDescription[], resolvePaths: boolean) {
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);
diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts
index 5c1aa0404a..14fb3d00b5 100644
--- a/tests/playwright-test/reporter-blob.spec.ts
+++ b/tests/playwright-test/reporter-blob.spec.ts
@@ -965,3 +965,11 @@ test('same project different suffixes', async ({ runInlineTest, mergeReports })
expect(exitCode).toBe(0);
expect(output).toContain(`projects: [ 'foo-first', 'foo-second' ]`);
});
+
+test('no reports error', async ({ runInlineTest, mergeReports }) => {
+ const reportDir = test.info().outputPath('blob-report');
+ fs.mkdirSync(reportDir, { recursive: true });
+ const { exitCode, output } = await mergeReports(reportDir);
+ expect(exitCode).toBe(1);
+ expect(output).toContain(`No report files found in`);
+});