chore: do not double trim in trace viewer (#12338)

This commit is contained in:
Max Schmitt 2022-02-24 21:55:50 +01:00 committed by GitHub
parent 91672595f2
commit 821a8e93c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 8 deletions

View File

@ -68,7 +68,7 @@ export const CallTab: React.FunctionComponent<{
function renderLine(metadata: CallMetadata, name: string, value: any, key: string) {
const { title, type } = toString(metadata, name, value);
let text = trimRight(title.replace(/\n/g, '↵'), 80);
let text = title.replace(/\n/g, '↵');
if (type === 'string')
text = `"${text}"`;
return <div key={key} className='call-line'>{name}: <span className={type} title={title}>{text}</span></div>;
@ -88,9 +88,3 @@ function toString(metadata: CallMetadata, name: string, value: any): { title: st
return { title: '<handle>', type: 'handle' };
return { title: JSON.stringify(value), type: 'object' };
}
function trimRight(text: string, max: number): string {
if (text.length > max)
return text.substr(0, max) + '\u2026';
return text;
}

View File

@ -250,7 +250,7 @@ test('should show params and return value', async ({ showTraceViewer, browserNam
/page.evaluate/,
/wall time: [0-9/:,APM ]+/,
/duration: [\d]+ms/,
'expression: "({↵ a↵ }) => {↵ console.log(\'Info\');↵ console.warn(\'Warning\');↵ con…"',
/expression: "\({↵ a↵ }\) => {↵ console\.log\(\'Info\'\);↵ console\.warn\(\'Warning\'\);↵ console/,
'isFunction: true',
'arg: {"a":"paramA","b":4}',
'value: "return paramA"'