Open eps1lon opened 4 years ago
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.
Comment
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
Bump
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
Bump
Yeah, I don't think this would hurt anything - happy to take a PR π
π Feature Proposal
Assign the test name to the test callback if the test callback is not named.
Naively add before https://github.com/facebook/jest/blob/eff3eaaad2bde223365da6522cfac7960267fb46/packages/jest-circus/src/index.ts#L182
Motivation
The passed callback to e.g.
test('my test description', () => { /* the callback */ })
is hard to find when profiling tests. Right now we have to explicitly name them viatest('my test description', function mySlowTest() { /* the callback */ })
.Example
@kentcdodds encountered the same issue and made a video explaining the issue: https://www.youtube.com/watch?v=RB2g-o39upo.
Pitch
Reduces barrier to entry into profiling jest tests. While I would consider naming functions a tool you should know about for profiling, I would always prefer to not change code when profiling/debugging.