vitest-dev / vitest-dev/vitest
Improve openTelemetry context propagation and user-land tracing in Vitest browser mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Clear and concise description of the problem
Context
In browser mode, Vitest cannot automatically propagate openTelemetry async context due to lack of async_hooks. User-defined spans often lose parent context across async operations (promises, timers, events), leading to incomplete or flat tracing. Internal spans are manually linked, but user/test code loses context in deeply async code paths.
Suggested solution
Explore robust async context tracking for browsers (e.g. zone.js or context polyfills), expose helpers in Vitest to allow manual context handling for user code, and document current limitations and any recommended workarounds for reliable tracing.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the discussion in PR #9180 and trace how Vitest browser mode handles user-defined spans across promises, timers, and events. Compare browser context-tracking options such as zone.js or context polyfills, then determine whether helpers or documentation are needed. Done means user-land tracing has a documented, reliable context-handling path or clearly stated limitations and workarounds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- observability, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100