chore: Update dependency k6 to v1.4.0 #462
Merged
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:
v1.3.0->v1.4.0Warning
Some dependencies could not be looked up. Check the warning logs for more information.
Release Notes
grafana/k6 (k6)
v1.4.0Compare Source
k6
v1.4.0is here 🎉! This release includes:page.waitForRequestfor waiting on specific HTTP requests.QueryAllmethods now return elements in DOM order.locator.evaluateandlocator.evaluateHandlefor executing JavaScript code in the page context with access to the matching element.page.unroute(url)andpage.unrouteAllfor removing routes registered withpage.route.Breaking changes
As per our stability guarantees, breaking changes across minor releases are allowed only for experimental features.
Breaking changes for experimental modules
zero/nonzerolabels instead of separate metrics.K6_OTEL_EXPORTER_TYPEis deprecated in favor ofK6_OTEL_EXPORTER_PROTOCOLto align with OpenTelemetry standards.Breaking changes for undefined behaviours
importstatements and no longer supports CommonJSrequire()calls. CommonJSrequire()calls are dynamic, and it is not possible to know for certain if they will be called, or if they will be called with static strings - the only way they were even previously loaded. This functionality was a quirk of the previous implementation and had numerous problems. Additionally,use k6directives are now only recognized when they appear at the beginning of files (after optional shebang and whitespace/comments). This was the original intention, but due to implementation bugs, it did not accurately reflect what was happening.New features
OpenTelemetry output graduation #5334
The OpenTelemetry output has graduated from experimental status and is now available as a stable output using the name
opentelemetry. This change makes OpenTelemetry the recommended vendor-agnostic solution for exporting k6 telemetry data.You can now use the stable output name in your k6 commands:
The
experimental-opentelemetryname will continue to work for backward compatibility for now but it's deprecated and we might remove it in future versions. We recommend migrating to use the newopentelemetryname.page.waitForRequest#5330The browser module now supports
page.waitForRequest(), which allows you to wait for HTTP requests that match specific URL patterns during browser automation. This method is particularly valuable for testing scenarios where you need to ensure specific network requests are initiated before proceeding with test actions.The method supports multiple URL pattern matching strategies:
This complements the existing
page.waitForResponse()method by focusing on HTTP requests rather than responses, providing more granular control over network-dependent test scenarios.page.unroute(url)andpage.unrouteAll()#5223The browser module now supports
page.unroute(url)andpage.unrouteAll(), allowing you to remove routes previously registered withpage.route.Example usage:
locator.evaluateandlocator.evaluateHandle#5306The browser module now supports
locator.evaluateandlocator.evaluateHandle, allowing you to execute JavaScript code in the page context with access to the matching element. The only difference betweenevaluateandevaluateHandleis thatevaluateHandlereturns a JSHandle.Example usage:
New officially supported k6 DNS extension
The
xk6-dnsextension is now officially supported in k6 OSS and k6 Cloud. You can importk6/x/dnsdirectly in your scripts thanks to automatic extension resolution, with no custom build required.Use it to perform DNS resolution testing as part of your tests: resolve names via custom or system DNS, measure resolution latency and errors, validate records before HTTP steps, compare resolvers, and even load test DNS servers in end‑to‑end scenarios.
For example:
The extension currently supports A and AAAA record lookups. If you would like to see additional record types supported, please consider contributing to the extension.
Automatic extension resolution improvements #5320, #5239, #5342, #5332, #5240
Automatic extension resolution has been completely reimplemented to use k6's internal module loader instead of the external
k6deps/esbuild pipeline. This change brings significant improvements in reliability and maintainability.As part of the rewrite, a few issues and unintended features were found, namely:
requirecalls, which, due to their dynamic nature, don't work particularly stably. That is, depending on where and how therequirecall was used, k6 might decide whether it is needed or not. And it definitely doesn't work when using actual string variables. Support for CommonJS is primarily for backward compatibility, so after an internal discussion, we opted not to support it at all. We could bring this back until v2, if there is enough interest. However, in the long term, it is intended that this not be part of k6.Example:
Or, an example using the directive with CommonJS
In this example, k6 will detect both
k6/x/fakerandk6/x/redisextensions from theuse k6directives in both files and provision a binary that includes both extensions if needed.Other fixes this brings are:
Fixes for path related issues (irregardless of usage of the feature) on windows, especially between drives. It is possible there were problems on other OSes that were just not reported. #5176
Syntax errors were not reported as such, as the underlying
esbuildparsing will fail, but won't be handled well. #5127, #5104Propagating exit codes from a sub-process running the new k6. This lets you use the result of the exit code.
UX improvements and enhancements
QueryAllmethods now return elements in DOM order. Thank you, @shota3506, for the contribution.Bug fixes
browser.newPageInContextbug where pages created in a non-existing browser context.Maintenance and internal improvements
k6ext.Promiseto the mapping layer.VUfields.envconfig.TestPageOnResponseto fail fast on errors. Thank you, @rMaxiQp for the contribution.requirecalls during the initial loading of modules, instead for each call in all execution of all VUs.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.