Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools logs Timeline metadata only once (when profiling starts) #23141

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
886 changes: 398 additions & 488 deletions packages/react-devtools-shared/src/__tests__/TimelineProfiler-test.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const MAX_DECIMAL_PLACES = 3;

// test() is part of Jest's serializer API
export function test(maybeNumber) {
return (
typeof maybeNumber === 'number' &&
Number.isFinite(maybeNumber) &&
!Number.isInteger(maybeNumber) &&
!Number.isNaN(maybeNumber)
);
}

// print() is part of Jest's serializer API
export function print(number, serialize, indent) {
const string = number.toString();
const pieces = string.split('.');
if (pieces.length === 2) {
if (pieces[1].length > MAX_DECIMAL_PLACES) {
return number.toFixed(MAX_DECIMAL_PLACES);
}
}

return string;
}
Loading