Skip to content

Commit 54d5b74

Browse files
rubennortefacebook-github-bot
authored andcommitted
Improve stack traces in benchmarks (#52828)
Summary: Pull Request resolved: #52828 Changelog: [internal] Just a small quality of life improvement. It forces the test functions in benchmarks to have the name of the test case if it's an anonymous function, so it shows better in stack traces. Reviewed By: sammy-SC Differential Revision: D78924769 fbshipit-source-id: 9b44a49feaae93ccfa90cc726274f0ea013654b1
1 parent bfe31ba commit 54d5b74

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

private/react-native-fantom/src/Benchmark.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ export function suite(
115115
continue;
116116
}
117117

118+
if (task.fn.name === '') {
119+
// $FlowExpectedError[cannot-write]
120+
Object.defineProperty(task.fn, 'name', {value: task.name});
121+
}
122+
118123
const {only, ...options} = task.options ?? {};
119124
bench.add(task.name, task.fn, options);
120125
}

0 commit comments

Comments
 (0)