Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created by
brew bump
Created with
brew bump-formula-pr
.release notes
k6 cloud
commands for local execution and uploading script filesBreaking changes
math/big.Int
type tobigint
type in k6.lib.Min
andlib.Max
from k6's Go API, which could affect custom extensions that rely on these functions.k6/experimental/timers
- they are now available globally and no import is needed.k6/experimental/websockets
, which makes thebinaryType
default value equal to"blob"
. With this change,k6/experimental/websockets
is now compliant with the specification.New features
Branding changes and logo
#3946
,#3953
,#3969
As part of joining Grafana Labs in 2021, k6 was renamed to Grafana k6. The original k6 logo and branding was purple, which didn't fit very well next to the Grafana Labs orange logo and all its other products.
In this release, we have a new logo in a new color, and the terminal banner has been redesigned to match the current branding more closely.
New experimental CSV module for efficient CSV data handling
#3743
We’ve added a new experimental CSV module to k6 for more efficient and convenient CSV parsing and streaming, addressing the limitations of preexisting JavaScript-based solutions like papaparse.
What is it?
The CSV module offers two key features:
csv.parse()
: This function parses a CSV file into a SharedArray at once using Go-based processing for faster parsing and lower memory usage compared to JavaScript alternatives.csv.Parser
: This class provides a streaming parser to read CSV files line-by-line, minimizing memory consumption and offering more control over parsing through a stream-like API. This is ideal for scenarios where memory optimization or fine-grained control of the parsing process is crucial.Benefits for users
csv.parse
bypasses most of the JavaScript runtime, offering significant speed improvements for large files.fs.open
function.csv.parse()
or memory-efficient streaming withcsv.Parser
.Tradeoffs
csv.Parse
: Parses the entire file in the initialization phase of the test, which can increase startup time and memory usage for large files. Best suited for scenarios where performance is prioritized over memory consumption.csv.Parser
: Reads the file line-by-line, making it more memory-efficient but potentially slower due to reading overhead for each line. Ideal for scenarios where memory usage is a concern or where fine-grained control over parsing is needed.Example usage
Expand to see an example of Parsing a full CSV file into a SharedArray.
Expand to see an example of streaming a CSV file line-by-line.
New
k6 cloud run --local-execution
flag for local execution of cloud tests#3904
, and #3931This release introduces the
--local-execution
flag for the k6 cloud run command, allowing you to run test executions locally while sending metrics to Grafana Cloud k6.By default, using the
--local-execution
flag uploads the test archive to Grafana Cloud k6. If you want to disable this upload, use the--no-archive-upload
flag.The
--local-execution
flag currently functions similarly to thek6 run -o cloud
command, which is now considered deprecated (though it is not planned to be removed). Future updates will enhance--local-execution
with additional capabilities that thek6 run -o cloud
command does not offer.New
k6 cloud upload
command for uploading test files to the cloud#3906
We continue to refine and improve the cloud service to improve how we handle uploading test files, so we've added a new
k6 cloud upload
command that replaces thek6 cloud --upload-only
flag, which is now considered deprecated.gRPC module updates driven by contributors
New
discardResponseMessage
option#3877 and #3820 add a new option for the gRPC module
discardResponseMessage
, which allows users to discard the messages received from the server.This reduces the amount of memory required and the amount of garbage collection, which reduces the load on the testing machine and can help produce more reliable test results.
Thank you, @lzakharov!
New argument
meta
for gRPC's stream callbacks#3801 adds a new argument
meta
to gRPC's stream callback, which handles the timestamp of the original event (for example, when a message has been received).Thank you, @cchamplin!
Allow missing file descriptors for gRPC reflection
#3871 allows missing file descriptors for gRPC reflection.
Thank you, @Lordnibbler!
Sobek updates brings support of new ECMAScript features into k6
#3899
,#3925
,#3913
With this release, we've updated Sobek (the
ECMAScript
implementation in Go) which contains the new ECMAScript features that are now available in k6.This includes support for numeric literal separators:
Support for
BigInt
, the values which are too large to be represented by the number primitive:Note: Before k6 version v0.54, Golang's type
math/big.Int
mapped to another type, so this might be a breaking change for some extensions or users.RegExp dotAll support, where you can match newline characters with
.
:Support for ES2023 Array methods:
with
,toSpliced
,toReversed
andtoSorted
.Thank you @shiroyk for adding both the new array methods and BitInt :bow:.
New
setChecked
method for the browser modulebrowser#1403
Previously, users could check or uncheck checkbox and radio button elements using the
check
anduncheck
methods. Now, we've added asetChecked
method that allows users to set a checkbox or radio button to either the checked or unchecked state with a single method and a boolean argument.Page, Frame, ElementHandle, and Locator now support the new
setChecked
method.Async
check
function utilityk6-utils#13
Writing concise code can be difficult when using the k6
check
function with async code since it doesn't support async APIs. A solution that we have suggested so far is to declare a temporary variable, wait for the value that is to be checked, and then check the result later. However, this approach can clutter the code with single-use declarations and unnecessary variable names, for example:To address this limitation, we've added a version of the
check
function to jslib.k6.io that makes working withasync
/await
simpler. Thecheck
function is a drop-in replacement for the built-in check, with added support for async code. AnyPromise
s will be awaited, and the result is reported once the operation has been completed:Check out the
check
utility function's documentation for more information on how to use it.k6/experimnetal/websockets
updates towards WebSockets API compatibilitySupport ArrayBufferViews in
send
fork6/experimental/websockets
#3944As part of making
k6/experimental/websockets
compliant with the WebSocket API, it now supports Uint8Array and other ArrayBufferViews directly as arguments tosend
, instead of having to specifically provide theirbuffer
.This should make the module more compliant with libraries that use the WebSocket API.
Thanks to @pixeldrew for reporting this. :bow:
readyState
actually being a number #3972Due to goja/Sobek internal workings,
readyState
wasn't exactly a number in JavaScript code. This had some abnormal behavior, which limited interoperability with libraries.This has been fixed, and
readyState
is a regular number from the JavaScript perspective.Thanks to @dougw-bc for reporting this. :bow:
Rework of how usage is being collected internally and additional counters
#3917
and#3951
As part of working on k6 over the years, we have often wondered if users use certain features or if they see a strange corner case behavior.
We have usually made guesses or tried to extrapolate from experience on issues we see. Unfortunately, this isn't always easy or possible, and it's definitely very skewed. As such, we usually also add warning messages to things we intend to break to inform people and ask them to report problems. But we usually see very little activity, especially before we make changes.
This also only works for things we want to remove, and it doesn't help us know if people use new functionality at all or if there are patterns we don't expect.
While k6 has been collecting usage for a while, they're surface-level things, such as how many VUs were run, the k6 version, or which internal modules were loaded. The system for this was also very rigid, requiring a lot of work to add simple things, such as if someone used the
require
function.This process has been reworked to make things easier, and a few new usage reports have been added:
require
. Now that we have ESM native support, usingrequire
and CommonJS adds complexity. It's interesting to us whether removing this in the future - likely years, given its support in other runtimes, is feasible.global
. This will help us decide if we can drop compatibility-mode differences or even the whole concept.UX improvements and enhancements
SetupTimeout
option validation. Thank you, @tsukasaI!k6 cloud login
, so now you get immediate feedback right after logging in.✓
and✗
forRate
metrics, and instead uses the form:{x} out of {y}
.Bug fixes
options
isnil
(e.g. exported from a module where it isn't really exported).cloud
command not being display in thek6
command's help text.page.reload
API so handlesnull
responses without exceptions.click
action.browser.close
to abort the cdp close request when the browser process has already exited.Maintenance and internal improvements
go.mod
to the go1.21, introduces toolchain.ExitCode
description typo. Thank you, @eltociear!fatcontext
andcononicalheader
as linters.NetTrail
internal type to simplify internal implementation on emitting iteration and data transmission metric.testutils.MakeMemMapFs
test helper facilitating simulating a file system in tests.TestStreamLogsToLogger
log sending delay to improve the reliability of tests.Roadmap
In version 0.52.0, the browser module transitioned from experimental to stable. The new module is more stable and has a full Async API. To ensure your scripts continue working, you must migrate to the new
k6/browser
module and discontinue using the previousk6/experimental/browser
module. Please see the migration guide for more details.