Skip to content

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

chore(reporter): drop column in markdown to prevent `:100:` :100: (#37054)

Simon Knott95501207d211
diff --git a/packages/playwright/src/reporters/markdown.ts b/packages/playwright/src/reporters/markdown.ts
index 3ac2934651..23bc643b1a 100644
--- a/packages/playwright/src/reporters/markdown.ts
+++ b/packages/playwright/src/reporters/markdown.ts
@@ -135,8 +135,8 @@ function formatTestTitle(rootDir: string, test: TestCase): string {
// root, project, file, ...describes, test
const [, projectName, , ...titles] = test.titlePath();
const relativeTestPath = path.relative(rootDir, test.location.file);
- // intentionally add a zero-width space to prevent creating markdown icons on GitHub
- const location = `${relativeTestPath}:${test.location.line}:${test.location.column}`;
+ // intentionally leave out column to prevent writing test.spec.ts:100:5 - GitHub turns that into 💯
+ const location = `${relativeTestPath}:${test.location.line}`;
const projectTitle = projectName ? `[${projectName}] › ` : '';
const testTitle = `${projectTitle}${location} › ${titles.join(' › ')}`;
const extraTags = test.tags.filter(t => !testTitle.includes(t));
diff --git a/tests/playwright-test/reporter-markdown.spec.ts b/tests/playwright-test/reporter-markdown.spec.ts
index 1748ecdf0c..9b6ebf9556 100644
--- a/tests/playwright-test/reporter-markdown.spec.ts
+++ b/tests/playwright-test/reporter-markdown.spec.ts
@@ -66,13 +66,13 @@ test('simple report', async ({ runInlineTest }) => {
expect(exitCode).toBe(1);
const reportFile = await fs.promises.readFile(test.info().outputPath('report.md'));
expect(reportFile.toString()).toContain(`**2 failed**
-:x: dir1${path.sep}a.test.js:6:11 › failing 1
-:x: dir2${path.sep}b.test.js:6:11 › failing 2
+:x: dir1${path.sep}a.test.js:6 › failing 1
+:x: dir2${path.sep}b.test.js:6 › failing 2
<details>
<summary><b>2 flaky</b></summary>
-:warning: c.test.js:6:11 › flaky 2 <br/>
-:warning: dir1${path.sep}a.test.js:9:11 › flaky 1 <br/>
+:warning: c.test.js:6 › flaky 2 <br/>
+:warning: dir1${path.sep}a.test.js:9 › flaky 1 <br/>
</details>
@@ -123,7 +123,7 @@ test('report error without snippet', async ({ runInlineTest }) => {
await runInlineTest(files);
const reportFile = await fs.promises.readFile(test.info().outputPath('report.md'));
expect(reportFile.toString()).toContain(`**1 failed**
-:x: a.test.js:3:11 › math 1
+:x: a.test.js:3 › math 1
**0 passed**
`);
@@ -195,7 +195,7 @@ test('report with annotations', async ({ runInlineTest }) => {
// Check that failed tests are reported with tags
expect(reportContent).toContain(`**1 failed**
-:x: a.test.js:14:11 › failing test with annotation \`@slow\``);
+:x: a.test.js:14 › failing test with annotation \`@slow\``);
// Check that passed tests are reported (but without individual titles)
expect(reportContent).toContain(`**1 passed**`);