k6
k6 copied to clipboard
Add ReadableStream support to k6
What?
It adds support for ReadableStream from Streams API through experimental k6/experimental/streams module.
Why?
This is a prerequisite to unlock the development of other features in k6. It is also a nice-to-have feature for k6 users in general, that may want to use ReadableStream on their own.
Note for the reviewer
You can find the rationale behind some technical decisions (around goja, promises, etc) present on this changeset, in this Google Doc that I used to write some personal notes, as takeaways during the development process.
On top of that, @oleiade and I decided to keep the code comments for each step of those operations defined in the spec because it makes it easier to:
- correlate the code and the spec.
- identify bugs or non-compliant behaviors.
- identify patterns that are repeated over the spec, and its correspondence in Go/goja.
So, although I know these could be arguable for some people, I'd personally push to keep them as long as I need to maintain and take care of this code.
Checklist
- [X] I have performed a self-review of my code.
- [X] I have added tests for my changes.
- [X] I have run linter locally (
make lint) and all checks pass. - [X] I have run tests locally (
make tests) and all tests pass. - [X] I have commented on my code, particularly in hard-to-understand areas.
Related PR(s)/Issue(s)
Closes #3659 Contributes to #2978
Codecov Report
Attention: Patch coverage is 0.28249% with 706 lines in your changes are missing coverage. Please review.
Project coverage is 70.79%. Comparing base (
f38ac59) to head (598ac70).
:exclamation: Current head 598ac70 differs from pull request most recent head 89302f2. Consider uploading reports for the commit 89302f2 to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## master #3696 +/- ##
==========================================
- Coverage 73.29% 70.79% -2.51%
==========================================
Files 278 287 +9
Lines 20456 21159 +703
==========================================
- Hits 14994 14979 -15
- Misses 4505 5217 +712
- Partials 957 963 +6
| Flag | Coverage Δ | |
|---|---|---|
| ubuntu | 70.79% <0.28%> (-2.44%) |
:arrow_down: |
| windows | ? |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @mstoykov (cc/ @oleiade),
I have pushed a few more commits with some changes that go in the line of what has been discussed here.
Note that the approach is specific for streams, thus not extensible, but I guess we can postpone the task of finding a way to make the WPTs setup available for other suites as a separate work.
I also took the opportunity to remove the support for console.log, as discussed here, in order to move that discussion outside the scope of this pull request, as it isn't strictly needed.
Please, let know what do you think about the new approach. Thanks! 🙇🏻
Just please squash on merge :grimacing:
👍🏻 😄 🦖