fix: quote trace file path when printing error message (#29052)

Fixes https://github.com/microsoft/playwright/issues/29039
This commit is contained in:
Yury Semikhatsky 2024-01-18 14:23:12 -08:00 committed by GitHub
parent 4a45724633
commit c76f5294ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -331,7 +331,7 @@ export function formatFailure(config: FullConfig, test: TestCase, options: {inde
const packageManagerCommand = getPackageManagerExecCommand();
resultLines.push(colors.cyan(` Usage:`));
resultLines.push('');
resultLines.push(colors.cyan(` ${packageManagerCommand} playwright show-trace ${relativePath}`));
resultLines.push(colors.cyan(` ${packageManagerCommand} playwright show-trace "${relativePath}"`));
resultLines.push('');
}
} else {

View File

@ -66,7 +66,7 @@ test('render trace attachment', async ({ runInlineTest }) => {
test('one', async ({}, testInfo) => {
testInfo.attachments.push({
name: 'trace',
path: testInfo.outputPath('trace.zip'),
path: testInfo.outputPath('my dir with space', 'trace.zip'),
contentType: 'application/zip'
});
expect(1).toBe(0);
@ -75,8 +75,8 @@ test('render trace attachment', async ({ runInlineTest }) => {
}, { reporter: 'line' });
const text = result.output.replace(/\\/g, '/');
expect(text).toContain(' attachment #1: trace (application/zip) ─────────────────────────────────────────────────────────');
expect(text).toContain(' test-results/a-one/trace.zip');
expect(text).toContain('npx playwright show-trace test-results/a-one/trace.zip');
expect(text).toContain(' test-results/a-one/my dir with space/trace.zip');
expect(text).toContain('npx playwright show-trace "test-results/a-one/my dir with space/trace.zip"');
expect(text).toContain(' ────────────────────────────────────────────────────────────────────────────────────────────────');
expect(result.exitCode).toBe(1);
});