Skip to content
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

Global timers #3706

Merged
merged 3 commits into from
Apr 26, 2024
Merged

Global timers #3706

merged 3 commits into from
Apr 26, 2024

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Apr 23, 2024

What?

Make k6/timers globally available

Why?

This is in general what most users expect - just being able to use setTimeout directly.

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make tests) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Related PR(s)/Issue(s)

#3589

@mstoykov mstoykov added this to the v0.51.0 milestone Apr 23, 2024
@mstoykov mstoykov requested a review from a team as a code owner April 23, 2024 13:13
@mstoykov mstoykov requested review from oleiade and joanlopez and removed request for a team April 23, 2024 13:13
@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2024

Codecov Report

Attention: Patch coverage is 69.23077% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 73.26%. Comparing base (0e48fa2) to head (a29726b).

❗ Current head a29726b differs from pull request most recent head 191c961. Consider uploading reports for the commit 191c961 to get more accurate results

Files Patch % Lines
js/modules/resolution.go 33.33% 1 Missing and 1 partial ⚠️
js/modulestest/runtime.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3706      +/-   ##
==========================================
- Coverage   73.30%   73.26%   -0.05%     
==========================================
  Files         278      278              
  Lines       20389    20398       +9     
==========================================
- Hits        14947    14945       -2     
- Misses       4492     4501       +9     
- Partials      950      952       +2     
Flag Coverage Δ
ubuntu 73.20% <69.23%> (-0.04%) ⬇️
windows 73.12% <69.23%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mstoykov mstoykov added the documentation-needed A PR which will need a separate PR for documentation label Apr 25, 2024
"clearTimeout": e.clearTimeout,
"setInterval": e.setInterval,
"clearInterval": e.clearInterval,
// TODO the usage of `ToValue` here is so that goja doesn't do it automatically later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit; I don't fully get what's pending "to do" here based on this comment 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a workaround for #3707

Maybe TODO isn't the best option here 🤔

@mstoykov mstoykov merged commit 294c316 into master Apr 26, 2024
22 checks passed
@mstoykov mstoykov deleted the globalTimers branch April 26, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation-needed A PR which will need a separate PR for documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants