chore: add quotes to the path only when necessary (#29057)
This is a follow-up to c76f5294ce
Reference https://github.com/microsoft/playwright/issues/29039
This commit is contained in:
parent
6a15d43539
commit
674988c633
|
|
@ -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 ${quotePathIfNeeded(relativePath)}`));
|
||||
resultLines.push('');
|
||||
}
|
||||
} else {
|
||||
|
|
@ -373,6 +373,12 @@ export function formatFailure(config: FullConfig, test: TestCase, options: {inde
|
|||
};
|
||||
}
|
||||
|
||||
function quotePathIfNeeded(path: string): string {
|
||||
if (/\W/.test(path))
|
||||
return `"${path}"`;
|
||||
return path;
|
||||
}
|
||||
|
||||
export function formatResultFailure(test: TestCase, result: TestResult, initialIndent: string, highlightCode: boolean): ErrorDetails[] {
|
||||
const errorDetails: ErrorDetails[] = [];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue