Skip to content

fix: add function name fallback for Jest timing marker matching#1314

Closed
Saga4 wants to merge 2 commits intomainfrom
fix/marker-matching-function-name
Closed

fix: add function name fallback for Jest timing marker matching#1314
Saga4 wants to merge 2 commits intomainfrom
fix/marker-matching-function-name

Conversation

@Saga4
Copy link
Contributor

@Saga4 Saga4 commented Feb 3, 2026

Summary

  • Adds function name fallback when matching timing markers
  • Fixes marker matching when test names are "unknown" in Vitest

Problem

When Vitest doesn't provide test context (or when tests are configured in certain ways), timing markers may have "unknown" as the test name. The marker matching logic was only matching by test name (group 2), causing all markers to fail matching.

Example failing marker:

!$######unknown:unknown:testFunction:1:42_0######$!

Solution

Added fallback to also match by function name (group 3 in the marker), which is always set correctly:

# Before (only test name matching):
matching_starts = [m for m in start_matches if sanitized_test_name in m.group(2)]

# After (test name OR function name matching):
matching_starts = [
    m for m in start_matches
    if sanitized_test_name in m.group(2) or sanitized_func_name == m.group(3)
]

Test plan

  • Added test file tests/test_verification/test_jest_marker_matching.py
  • Tests verify fallback matching works correctly
  • Tests verify normal matching still works
  • Manual testing with Vitest-based projects

Generated with Claude Code

Saga4 and others added 2 commits February 3, 2026 18:06
When Vitest doesn't provide test context, timing markers may have
"unknown" as the test name. This caused marker matching to fail
since we were only matching by test name.

Added fallback to also match by function name (group 3 in the marker),
which is always set correctly even when test name is "unknown".

Fixes:
- "overall summed benchmark runtime is 0" errors when test names are unknown
- Marker matching for Vitest-based projects

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Saga4
Copy link
Contributor Author

Saga4 commented Feb 3, 2026

Closing - needs more verification before merging

@Saga4 Saga4 closed this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant