feat(base-reporter): Add tags to test output (#32930)
This commit is contained in:
parent
7047c3a6c6
commit
04bf425268
|
@ -410,7 +410,8 @@ 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}] › ` : '';
|
||||
return `${projectTitle}${location} › ${titles.join(' › ')}${stepSuffix(step)}`;
|
||||
const tags = test.tags.length > 0 ? ` ${test.tags.join(' ')}` : '';
|
||||
return `${projectTitle}${location} › ${titles.join(' › ')}${stepSuffix(step)}${tags}`;
|
||||
}
|
||||
|
||||
function formatTestHeader(config: FullConfig, test: TestCase, options: { indent?: string, index?: number, mode?: 'default' | 'error' } = {}): string {
|
||||
|
|
|
@ -418,5 +418,19 @@ for (const useIntermediateMergeReport of [false, true] as const) {
|
|||
expect(result.passed).toBe(1);
|
||||
expect(result.output).toMatch(/\d+ passed \(\d+(\.\d)?(ms|s)\)/);
|
||||
});
|
||||
|
||||
test('should output tags', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
const { test, expect } = require('@playwright/test');
|
||||
test('passes', { tag: ['@foo', '@bar'] }, async ({}) => {
|
||||
expect(0).toBe(0);
|
||||
});
|
||||
`,
|
||||
});
|
||||
const text = result.output;
|
||||
|
||||
expect(text).toContain('passes @foo @bar');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue