mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(test runner): trim full output path (#12239)
Previously, we only trimmed the "full title" component, but we should also trim the "relative path" component.
This commit is contained in:
parent
a7ef1da5e9
commit
ee0dd6ec71
@ -117,7 +117,7 @@ export class TestInfoImpl implements TestInfo {
|
|||||||
const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === 'win32' ? new RegExp('\\\\', 'g') : new RegExp('/', 'g'), '-');
|
const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === 'win32' ? new RegExp('\\\\', 'g') : new RegExp('/', 'g'), '-');
|
||||||
const fullTitleWithoutSpec = test.titlePath().slice(1).join(' ') + (test._type === 'test' ? '' : '-worker' + this.workerIndex);
|
const fullTitleWithoutSpec = test.titlePath().slice(1).join(' ') + (test._type === 'test' ? '' : '-worker' + this.workerIndex);
|
||||||
|
|
||||||
let testOutputDir = sanitizedRelativePath + '-' + sanitizeForFilePath(trimLongString(fullTitleWithoutSpec));
|
let testOutputDir = trimLongString(sanitizedRelativePath + '-' + sanitizeForFilePath(fullTitleWithoutSpec));
|
||||||
if (uniqueProjectNamePathSegment)
|
if (uniqueProjectNamePathSegment)
|
||||||
testOutputDir += '-' + sanitizeForFilePath(uniqueProjectNamePathSegment);
|
testOutputDir += '-' + sanitizeForFilePath(uniqueProjectNamePathSegment);
|
||||||
if (this.retry)
|
if (this.retry)
|
||||||
|
@ -431,7 +431,7 @@ test('should allow nonAscii characters in the output dir', async ({ runInlineTes
|
|||||||
|
|
||||||
test('should allow shorten long output dirs characters in the output dir', async ({ runInlineTest }, testInfo) => {
|
test('should allow shorten long output dirs characters in the output dir', async ({ runInlineTest }, testInfo) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'my-test.spec.js': `
|
'very/deep/and/long/file/name/that/i/want/to/be/trimmed/my-test.spec.js': `
|
||||||
const { test } = pwt;
|
const { test } = pwt;
|
||||||
test.describe('this is a really long description that would be too long for a file path', () => {
|
test.describe('this is a really long description that would be too long for a file path', () => {
|
||||||
test('and this is an even longer test name that just keeps going and going and we should shorten it', async ({}, testInfo) => {
|
test('and this is an even longer test name that just keeps going and going and we should shorten it', async ({}, testInfo) => {
|
||||||
@ -441,7 +441,7 @@ test('should allow shorten long output dirs characters in the output dir', async
|
|||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
const outputDir = result.output.split('\n').filter(x => x.startsWith('%%'))[0].slice('%%'.length);
|
const outputDir = result.output.split('\n').filter(x => x.startsWith('%%'))[0].slice('%%'.length);
|
||||||
expect(outputDir).toBe(path.join(testInfo.outputDir, 'test-results', 'my-test-this-is-a-really-long-description-that-would-b-6d724--keeps-going-and-going-and-we-should-shorten-it'));
|
expect(outputDir).toBe(path.join(testInfo.outputDir, 'test-results', 'very-deep-and-long-file-name-that-i-want-to-be-99202--keeps-going-and-going-and-we-should-shorten-it'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should not mangle double dashes', async ({ runInlineTest }, testInfo) => {
|
test('should not mangle double dashes', async ({ runInlineTest }, testInfo) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user