-
-
Notifications
You must be signed in to change notification settings - Fork 50
feat: add async option #371
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
Conversation
commit: |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for explicitly setting the async option for benchmark tasks in Tinybench. This allows users to override the automatic async detection behavior, which is useful when a function returns a Promise but should be treated as synchronous (e.g., for API compatibility), or vice versa.
Key Changes:
- Added an optional
asyncboolean field to theFnOptionsinterface - Updated the
Taskconstructor to respect the explicitasyncoption when provided, falling back to automatic detection otherwise - Added comprehensive documentation explaining async detection behavior and how to use the new option
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/types.ts | Added async optional field to FnOptions interface with documentation |
| src/task.ts | Modified Task constructor to use explicit async option when provided, falling back to isFnAsyncResource() |
| README.md | Added "Async Detection" section with detailed explanation and usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jerome-benoit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
fix #370