From b1fb4f16a75994330e38ea14fa38423d66197f40 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 18 Oct 2024 23:00:05 +0200 Subject: [PATCH] chore: hide 'markdown' reporter (#33140) --- .github/workflows/merge.config.ts | 2 +- packages/playwright/src/common/config.ts | 2 +- packages/playwright/src/runner/reporters.ts | 2 -- tests/playwright-test/reporter-markdown.spec.ts | 10 ++++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/merge.config.ts b/.github/workflows/merge.config.ts index b39944bc80..e8582ed521 100644 --- a/.github/workflows/merge.config.ts +++ b/.github/workflows/merge.config.ts @@ -1,4 +1,4 @@ export default { testDir: '../../tests', - reporter: [['markdown'], ['html']] + reporter: [[require.resolve('../../packages/playwright/lib/reporters/markdown')], ['html']] }; \ No newline at end of file diff --git a/packages/playwright/src/common/config.ts b/packages/playwright/src/common/config.ts index fd78f0c8d9..031a5215f2 100644 --- a/packages/playwright/src/common/config.ts +++ b/packages/playwright/src/common/config.ts @@ -276,7 +276,7 @@ export function toReporters(reporters: BuiltInReporter | ReporterDescription[] | return reporters; } -export const builtInReporters = ['list', 'line', 'dot', 'json', 'junit', 'null', 'github', 'html', 'blob', 'markdown'] as const; +export const builtInReporters = ['list', 'line', 'dot', 'json', 'junit', 'null', 'github', 'html', 'blob'] as const; export type BuiltInReporter = typeof builtInReporters[number]; export type ContextReuseMode = 'none' | 'when-possible'; diff --git a/packages/playwright/src/runner/reporters.ts b/packages/playwright/src/runner/reporters.ts index 2f7b16f2a6..2bab152f08 100644 --- a/packages/playwright/src/runner/reporters.ts +++ b/packages/playwright/src/runner/reporters.ts @@ -25,7 +25,6 @@ import JSONReporter from '../reporters/json'; import JUnitReporter from '../reporters/junit'; import LineReporter from '../reporters/line'; import ListReporter from '../reporters/list'; -import MarkdownReporter from '../reporters/markdown'; import type { Suite } from '../common/test'; import type { BuiltInReporter, FullConfigInternal } from '../common/config'; import { loadReporter } from './loadUtils'; @@ -45,7 +44,6 @@ export async function createReporters(config: FullConfigInternal, mode: 'list' | junit: JUnitReporter, null: EmptyReporter, html: HtmlReporter, - markdown: MarkdownReporter, }; const reporters: ReporterV2[] = []; descriptions ??= config.config.reporter; diff --git a/tests/playwright-test/reporter-markdown.spec.ts b/tests/playwright-test/reporter-markdown.spec.ts index d24f2561c1..076e28d66e 100644 --- a/tests/playwright-test/reporter-markdown.spec.ts +++ b/tests/playwright-test/reporter-markdown.spec.ts @@ -18,12 +18,14 @@ import fs from 'fs'; import path from 'path'; import { expect, test } from './playwright-test-fixtures'; +const markdownReporter = require.resolve('../../packages/playwright/lib/reporters/markdown'); + test('simple report', async ({ runInlineTest }) => { const files = { 'playwright.config.ts': ` module.exports = { retries: 1, - reporter: 'markdown', + reporter: ${JSON.stringify(markdownReporter)}, }; `, 'dir1/a.test.js': ` @@ -83,7 +85,7 @@ test('custom report file', async ({ runInlineTest }) => { const files = { 'playwright.config.ts': ` module.exports = { - reporter: [['markdown', { outputFile: 'my-report.md' }]], + reporter: [[${JSON.stringify(markdownReporter)}, { outputFile: 'my-report.md' }]], }; `, 'a.test.js': ` @@ -107,7 +109,7 @@ test('report error without snippet', async ({ runInlineTest }) => { 'playwright.config.ts': ` module.exports = { retries: 1, - reporter: 'markdown', + reporter: ${JSON.stringify(markdownReporter)}, }; `, 'a.test.js': ` @@ -135,7 +137,7 @@ test('report with worker error', async ({ runInlineTest }) => { 'playwright.config.ts': ` module.exports = { retries: 1, - reporter: 'markdown', + reporter: ${JSON.stringify(markdownReporter)}, }; `, 'a.test.js': `