fix(deps): update module go.k6.io/k6 to v0.59.0 #13
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.
This PR contains the following updates:
v0.49.0->v0.59.0Release Notes
grafana/k6 (go.k6.io/k6)
v0.59.0Compare Source
The
v0.59.0release mirrors the previousv1.0.0-rc2release to allow automation tools to recognize it as the latest version.For example, Homebrew's k6 formulae and pkg.go.dev do not automatically fetch unstable versions such as
v1.0.0-rc2, which is legitimately the expected behavior for these tools.However, this has been the default for all previous
v0.*releases, where they were considered the latest stable version—even if they were under a version typically associated with unstable releases. To address this, we will continue releasing mirrored versions underv0.*for necessary release candidates.This practice will end once the official stable
v1.0.0release is available, after which we will follow the standard SemVer lifecycle to simplify the workflow for everyone.The release notes for v1.0.0-rc2 provide a detailed look at all the changes that have been implemented since
v1.0.0-rc1/v0.58.0and are now part of this version.v0.58.0Compare Source
The
v0.58.0release mirrors the previousv1.0.0-rc1release to allow automation tools to recognize it as the latest version.For example, Homebrew's k6 formulae and pkg.go.dev do not automatically fetch unstable versions such as
v1.0.0-rc1, which is legitimately the expected behavior for these tools.However, this has been the default for all previous
v0.*releases, where they were considered the latest stable version—even if they were under a version typically associated with unstable releases. To address this, we will continue releasing mirrored versions underv0.*for necessary release candidates.This practice will end once the official stable
v1.0.0release is available, after which we will follow the standard SemVer lifecycle to simplify the workflow for everyone.The release notes for v1.0.0-rc1 provide a detailed look at all the changes that have been implemented since
v0.57.0and are now part of this version.v0.57.0Compare Source
k6
v0.57.0is here 🎉! This release includes:k6 newcommand now supports templates and ProjectIDs.k6/experimental/csvmodule gets a newasObjectsoption.k6/experimental/browsermodule, in favor ofk6/browser.internalpackage.Breaking changes
k6/experimental/browser. If you're still using it, follow the instructions to move to the graduated and stablek6/browsermodule.internalpackage. This was based on the publicly available extensions for k6 and may break private ones. More APIs will likely be removed or updated in follow-up releases after this more mechanical change..tsextension. It also deprecatesexperimental_enhancedcompatibility mode as it is no longer necessary.New features
New functional testing focused official jslib k6-testing
The k6 team has been developing a new official jslib dedicated to functional testing. While it is still under active development and will potentially see breaking changes, the set of APIs and behaviors it offers are meant to make their way into k6 eventually, and it is now available for early feedback.
k6-testing is a k6 JavaScript library that offers a seamless way to write functional tests in k6, using a Playwright-compatible assertions API. It exposes an
expectfunction, with which assertions can be performed using specific matchers that reflect the expected results.Unlike current k6's
checkwhenexpectsassertions fail, the test will immediately fail with a clear error message, including the expected and actual values in a similar fashion to what users would observe when using Playwright assertions.There are many generic matchers (and more to come), such as
toEqual,toBe, ortoBeTruthy, to only name a few, that can be used to assert conditions during a k6 test.k6-jslib-testing also includes browser-specific async matchers that wait until the expected condition is met such as
toBeVisible,toBeDisabled, ortoBeChecked, to name a few.It is currently available as part of the jslib.k6.io repository and is available to use in your k6 tests by adding the following import:
Try it out and give us feedback or contribute to the project on the k6-jslib-testing repository!
--templateand--project-idflags fork6 newcommand #4153The
k6 newcommand has been revamped to provide an improved experience when scaffolding new k6 tests. It now supports a--templateflag with options such asminimal,protocol, andbrowser, letting you generate a script tailored to your specific use case.The command also now accepts a
--project-idflag, which allows you to easily parameterize the test's Grafana Cloud configuration.New
asObjectsoption ink6/experimental/csvmodule #4295The CSV module's parsing operations now support the
asObjectsoption, which enables parsing CSV data into JavaScript objects instead of arrays of strings (the default behavior).When
asObjectsis set totrue, the module parses CSV data into objects where:With the option set to
true,the following CSV file:
will be parsed into the following JavaScript objects:
Refer to the CSV module's documentation for more information.
UX improvements and enhancements
xk6-browser-data-tok6browser-data-.filescheme URLs across file loading APIs -open,k6/experimental/fs.openandk6/net/grpc.Client#load.Bug fixes
--local-executionruns by isolatingArchive's urls.Maintenance and internal improvements
modulestestto make experimental streams test simpler.browsermodule working with reused VUs that originally weren't used in browser scenarios.v0.56.0Compare Source
k6
v0.56.0is here 🎉! This release includes:Breaking changes
accessibility-eventsfrom a test, which is no longer a valid permission that can be granted by the latest version of Chromium/Chrome.lib/consts.FullVersionfrom the k6's Golang API.New features
Merge browser code in k6 codebase #4056
While the browser module has been stabilized, the codebase was not moved inside of k6.
As part of the stabilization this is now also merged in the k6 codebase. In the following months we would move issues from the xk6-browser repo and then archive it.
UX improvements and enhancements
Headlessfrom the user agent to prevent test traffic from being blocked.--jsonflag to ak6 versionsub-command, which switches an output to a JSON format.resource_typetag which can be one of these values:"Document","Stylesheet","Image","Media","Font","Script","TextTrack","XHR","Fetch","Prefetch","EventSource","WebSocket","Manifest","SignedExchange","Ping","CSPViolationReport","Preflight","Other", or"Unknown".__ENV.K6_CLOUDRUN_TEST_RUN_IDwith the corresponding value for local executions streaming results to the Cloud:k6 cloud run --local-execution.Bug fixes
Geolocation.Accuracyfield.Object.Get(key)by returning*[]anyinstead of[]any.locatorAPIs to wait during a navigation without erroring out.frame.title.locator.selectOptionwhen value is an object.page.screenshot.evaluateorevaluateHandlewith an invalid page function.nullduring the creation of a page.Maintenance and internal improvements
(*Regexp).MatchStringto avoid unnecessary[]byteconversions. Thanks, @Juneezee for the contribution.Roadmap
Removal of deprecated
k6/experimental/browsermoduleSince
v0.52.0we have had a non experimental version of the browser module (k6/browser). We urge you to migrate your scripts over to the non experimental browser module as we will be removing the experimental version of it in the next release (v0.57.0).v0.55.2Compare Source
k6
v0.55.2is a patch release that fixes packaging issue.There are no functional changes in k6 compared to v0.55.1.
v0.55.1Compare Source
k6
v0.55.1is here 🎉! This release includes:golang.org/x/net.Maintenance and internal improvements
golang.org/x/netwhich contains a fix for CVE-2024-45338.v0.55.0Compare Source
k6
v0.55.0is here 🎉! This release includes:k6/experimental/tracingmodule has been removed.awaitsupport.k6/experimental/webcrypto.Breaking changes
k6/experimental/tracingmodule removed#3855The experimental
k6/experimental/tracingmodule has been removed, in favor of a replacement jslib polyfill, please consult our guide on how to migrate,#3855.StatsD output removed
#3849The StatsD output was deprecated in k6 v0.47.0 and is now removed. You could still output results to StatsD using the community xk6 extension LeonAdato/xk6-output-statsd. Thanks, @LeonAdato for taking over the extension!
openwill have a breaking change in the future.Currently,
openopens relative files based on an unusual root, similar to howrequirebehaved before it was updated for ESM compatibility. To make k6 more consistent,openand other functions like it will start handling relative paths in the same way as imports andrequire.For a more in-depth explanation, please refer to the related issue.
With this version, k6 will start emitting warnings when it detects that in the future, this will break. We recommend using
import.meta.resolve()as a way to make your scripts future proof.http.file#datanow truly has the same type as the provided data#4009Previously
http.file#datawas always a slice of byte ([]byte) - which was very likely a bug and a leftover from years past.The original aim (also documented) was to have the same type as the data provided when creating the
http.fileobject, and it is now effectively the case.New features
Top-level await support
4007After the initial native support for ECMAScript modules, k6 can now load those modules asynchronously which also allows
awaitto be used in the top-level of a module. That is you can writeawait someFunc()directly in the top most level of a module instead of having to make an async function that you call that can than useawait.Until now, you had to wrap your code in an async function to use
awaitin the top-level of a module. For example, the following code:Can now be written as:
This should make using the increasing number of async APIs in k6 easier in the init context.
This is not allowed in case of using the CommonJS modules, only ECMAScript modules, as CommonJS modules are synchronous by definition.
Complete1 RSA support for
k6/experimental/webcrypto#4025This update includes support for the RSA family of algorithms, including
RSA-OAEP,RSA-PSSandRSASSA-PKCS1-v1_5. You can use these algorithms with thecrypto.subtleAPI in the same way as the other algorithms, precisely forgenerateKey,importKey,exportKey,encrypt,decrypt,sign, andverifyoperations.By implementing RSA support, we make our WebCrypto API implementation more complete and useful for a broader range of use cases.
Example usage
Expand to see an example of generation RSA-PSS key pair.
page.on('metric)to group urls browser#371, browser#1487Modern websites are complex and make a high number of requests to function as intended by their developers. These requests no longer serve only content for display to the end user but also retrieve insights, analytics, advertisements, and for cache-busting purposes. Such requests are usually generated dynamically and may contain frequently changing IDs, posing challenges when correlating and analyzing your k6 test results.
When load testing a website using the k6 browser module, these dynamic requests can result in a high number of similar-looking requests, making it difficult to correlate them and extract valuable insights. This can also lead to test errors, such as a "too-many-metrics" error, due to high cardinality from metrics tagged with similar but dynamically changing URLs.
This issue also affects synthetic tests. While you may not encounter the "too-many-metrics" error, you may end up with a large amount of uncorrelated metric data that cannot be tracked effectively over time.
To address this in the browser module, we have implemented
page.on('metric'), which allows you to define URL patterns using regex for matching. When a match is found, the URL and name tags for the metric are replaced with the new name.Example usage
Expand to see an example of working with `page.on('metric')`.
ControlOrMetasupport in the keyboard browser#1457This approach enables tests to be written for all platforms, accommodating either
ControlorMetafor keyboard actions. For example,Control+clickon Windows andMeta+clickon Mac to open a link in a new window.Example usage
Expand to see an example usage of `ControlOrMeta`
UX improvements and enhancements
waitForSelectorerror message to better reflect why a selector doesn't resolve to an element.experimental-prometheus-rwoutput. This allows users to authenticate with AWS services that require SigV4 signing. Thanks, @obanby for the contribution!OTEL_SERVICE_NAMEenvironment variable for theexperimental-opentelemetryoutput. This aligns better with standard OTEL practices. Thanks, @TimotejKovacka for the contribution!page.waitForTimeoutwith tracing which will allow it to be displayed in the timeline.Bug fixes
page.on.locator.waitForso it waits between navigations and doesn't throw an error.awaitstatement.Maintenance and internal improvements
checkhelper.page.onevent code to streamline the addition and running of additional events.downloadsPathoption to specify the download directory. The browser module doesn't yet respect this option, but it will in the next release.checkpolyfill, for the async checks.v0.54.0Compare Source
k6
v0.54.0is here 🎉! This release includes:k6 cloudcommands for local execution and uploading script filesBreaking changes
math/big.Inttype tobiginttype in k6.lib.Minandlib.Maxfrom 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 thebinaryTypedefault value equal to"blob". With this change,k6/experimental/websocketsis now compliant with the specification.New features
Branding changes and logo
#3946,#3953,#3969As 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
#3743We’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.parsebypasses most of the JavaScript runtime, offering significant speed improvements for large files.fs.openfunction.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-executionflag for local execution of cloud tests#3904, and #3931This release introduces the
--local-executionflag 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-executionflag uploads the test archive to Grafana Cloud k6. If you want to disable this upload, use the--no-archive-uploadflag.The
--local-executionflag currently functions similarly to thek6 run -o cloudcommand, which is now considered deprecated (though it is not planned to be removed). Future updates will enhance--local-executionwith additional capabilities that thek6 run -o cloudcommand does not offer.New
k6 cloud uploadcommand for uploading test files to the cloud#3906We continue to refine and improve the cloud service to improve how we handle uploading test files, so we've added a new
k6 cloud uploadcommand that replaces thek6 cloud --upload-onlyflag, which is now considered deprecated.gRPC module updates driven by contributors
New
discardResponseMessageoption#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
metafor gRPC's stream callbacks#3801 adds a new argument
metato 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,#3913With this release, we've updated Sobek (the
ECMAScriptimplementation 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.Intmapped 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,toReversedandtoSorted.Thank you @shiroyk for adding both the new array methods and BitInt 🙇.
New
setCheckedmethod for the browser modulebrowser#1403Previously, users could check or uncheck checkbox and radio button elements using the
checkanduncheckmethods. Now, we've added asetCheckedmethod 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
setCheckedmethod.Async
checkfunction utilityk6-utils#13Writing concise code can be difficult when using the k6
checkfunction 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
checkfunction to jslib.k6.io that makes working withasync/awaitsimpler. Thecheckfunction is a drop-in replacement for the built-in check, with added support for async code. AnyPromises will be awaited, and the result is reported once the operation has been completed:Check out the
checkutility function's documentation for more information on how to use it.k6/experimnetal/websocketsupdates towards WebSockets API compatibilitySupport ArrayBufferViews in
sendfork6/experimental/websockets#3944As part of making
k6/experimental/websocketscompliant 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. 🙇
readyStateactually being a number #3972Due to goja/Sobek internal workings,
readyStatewasn't exactly a number in JavaScript code. This had some abnormal behavior, which limited interoperability with libraries.This has been fixed, and
readyStateis a regular number from the JavaScript perspective.Thanks to @dougw-bc for reporting this. 🙇
Rework of how usage is being collected internally and additional counters
#3917and#3951As 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
requirefunction.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, usingrequireand 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
SetupTimeoutoption validation. Thank you, @tsukasaI!k6 cloud login, so now you get immediate feedback right after logging in.✓and✗forRatemetrics, and instead uses the form:{x} out of {y}.Bug fixes
optionsisnil(e.g. exported from a module where it isn't really exported).cloudcommand not being display in thek6command's help text.page.reloadAPI so handlesnullresponses without exceptions.clickaction.browser.closeto abort the cdp close request when the browser process has already exited.Maintenance and internal improvements
go.modto the go1.21, introduces toolchain.ExitCodedescription typo. Thank you, @eltociear!fatcontextandcononicalheaderas linters.NetTrailinternal type to simplify internal implementation on emitting iteration and data transmission metric.testutils.MakeMemMapFstest helper facilitating simulating a file system in tests.TestStreamLogsToLoggerlog sending delay to improve the reliability of tests.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
Need help?
You can ask for more help in the following Slack channel: #proj-renovate-self-hosted. In that channel you can also find ADR and FAQ docs in the Resources section.
Footnotes
Since under the hood we do fully rely on the Golang's SDK, our implementation doesn't support zero salt lengths for the
RSA-PSSsign/verifyoperations. ↩