chore: dedupe tags in base reporter title (#33461)
This commit is contained in:
parent
a655b0bfb3
commit
9d94ad152e
|
@ -383,8 +383,9 @@ export function formatTestTitle(config: FullConfig, test: TestCase, step?: TestS
|
|||
else
|
||||
location = `${relativeTestPath(config, test)}:${step?.location?.line ?? test.location.line}:${step?.location?.column ?? test.location.column}`;
|
||||
const projectTitle = projectName ? `[${projectName}] › ` : '';
|
||||
const tags = test.tags.length > 0 ? ` ${test.tags.join(' ')}` : '';
|
||||
return `${projectTitle}${location} › ${titles.join(' › ')}${stepSuffix(step)}${tags}`;
|
||||
const testTitle = `${projectTitle}${location} › ${titles.join(' › ')}`;
|
||||
const extraTags = test.tags.filter(t => !testTitle.includes(t));
|
||||
return `${testTitle}${stepSuffix(step)}${extraTags.length ? ' ' + extraTags.join(' ') : ''}`;
|
||||
}
|
||||
|
||||
export function formatTestHeader(config: FullConfig, test: TestCase, options: { indent?: string, index?: number, mode?: 'default' | 'error' } = {}): string {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { test, expect } from './playwright-test-fixtures';
|
||||
import { test, expect, stripAnsi } from './playwright-test-fixtures';
|
||||
import * as path from 'path';
|
||||
|
||||
for (const useIntermediateMergeReport of [false, true] as const) {
|
||||
|
@ -470,14 +470,21 @@ for (const useIntermediateMergeReport of [false, true] as const) {
|
|||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
const { test, expect } = require('@playwright/test');
|
||||
test('passes', { tag: ['@foo', '@bar'] }, async ({}) => {
|
||||
test('passes', { tag: ['@foo1', '@foo2'] }, async ({}) => {
|
||||
expect(0).toBe(0);
|
||||
});
|
||||
test('passes @bar1 @bar2', async ({}) => {
|
||||
expect(0).toBe(0);
|
||||
});
|
||||
test('passes @baz1', { tag: ['@baz2'] }, async ({}) => {
|
||||
expect(0).toBe(0);
|
||||
});
|
||||
`,
|
||||
});
|
||||
const text = result.output;
|
||||
|
||||
expect(text).toContain('passes @foo @bar');
|
||||
const text = stripAnsi(result.output);
|
||||
expect(text).toContain('› passes @foo1 @foo2 (');
|
||||
expect(text).toContain('› passes @bar1 @bar2 (');
|
||||
expect(text).toContain('› passes @baz1 @baz2 (');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue