diff --git a/packages/playwright/src/reporters/base.ts b/packages/playwright/src/reporters/base.ts index de5a26640f..2c6600f1b0 100644 --- a/packages/playwright/src/reporters/base.ts +++ b/packages/playwright/src/reporters/base.ts @@ -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 { diff --git a/tests/playwright-test/reporter-attachment.spec.ts b/tests/playwright-test/reporter-attachment.spec.ts index d761c0a4da..fd938be437 100644 --- a/tests/playwright-test/reporter-attachment.spec.ts +++ b/tests/playwright-test/reporter-attachment.spec.ts @@ -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); });