release notes/v1.0.0-rc1.md
k6 v1.0.0-rc1 is here π!
This release marks a special, non-conventional milestone in the k6 software life-cycle, serving as a preview of the upcoming version 1.0.0.
The purpose of this release is to give the community a chance to test the new version, identify any potential issues, and test migrations of any parts affected by breaking changes. If you encounter any problems or have trouble with the migration, we encourage you to report them by creating an issue. Your feedback will help improve the final release. If no critical issues are reported, we plan to release the final v1.0.0 within the next month.
Hereβs a glimpse of whatβs new in this release:
k6/experimental/webcrypto promoted to stable and available globally under crypto.k6/browser provided an API for tracking network requests and responses.k6/secrets module for retrieving secrets with extension support.,) are now supported in the values of the --tag CLI flag. This is a breaking change, as previously, a comma meant the start of a new set of tag-values. As a comma is a valid symbol for the value of a tag, this is necessary to have equivalency between different ways of setting tags. This still allows multiple tags to be set on the CLI with multiple --tag key=value arguments.When running the k6 cloud login or the deprecated k6 login commands, a configuration file was automatically created at {USER_CONFIG_DIR}/loadimpact/config.json. Now, the configuration file is created at {USER_CONFIG_DIR}/k6/config.json.
To migrate your configuration file to the new path:
k6 cloud login or k6 login to automatically migrate the configuration file to the new location.k6 cloud run or k6 run to verify that the version is now fully functional and no related warning is emitted.The configuration file in the old path remains available and can continue to be used with the previous k6 versions. If you're not using an old version of k6 anymore, consider deleting the files manually.
The k6 run commands search for the configuration file in the new location. If it can't find it, it tries to fall back on the old path and then logs a warning message suggesting to migrate it.
The end-of-test-summary has been revamped to make it easier for users to understand test results. That includes:
The new end-of-test summary is enabled by default for users, but you can use the summary-mode flag to choose between different modes:
compact (default): what you can see in the example above, with the most relevant information.full: similar to compact, but also includes some more detailed metrics and results for each group and scenario defined in the test.legacy: the old summary format for backward compatibility.Note: The data structure received by the
handleSummaryfunction, as well as the data exported using--summary-export, has not changed in this release. However, these may change in upcoming releases, which could introduce breaking changes.
The browser module adds support for tracking network requests and responses. This feature is especially useful for validating certain aspects of the requests and responses to determine whether the test was successful. It can also be used to debug issues with the test script or the tested application. Refer to the documentation for more details.
For example, to track all requests and responses made by a page, you can use the following script:
import { browser } from 'k6/browser';
export const options = {
scenarios: {
ui: {
executor: 'shared-iterations',
options: {
browser: {
type: 'chromium',
},
},
},
},
};
export default async function () {
const page = await browser.newPage();
// registers a handler that logs all requests made by the page
page.on('request', async request => console.log(request.url()));
// registers a handler that logs all responses received by the page
page.on('response', async response => console.log(response.url()));
await page.goto('https://quickpizza.grafana.com/', { waitUntil: 'networkidle' });
await page.close();
}
The output might look like this:
INFO[0000] https://quickpizza.grafana.com/ source=console
INFO[0001] https://quickpizza.grafana.com/api/tools source=console
INFO[0001] https://quickpizza.grafana.com/images/pizza.png source=console
...
k6/experimental/webcrypto promoted to stable and available globally under crypto #4278With this release, the k6/experimental/webcrypto module is promoted to stable and available globally under crypto. That means you can remove the import { crypto } from 'k6/experimental/webcrypto'; statement from your scripts and still use the module.
export default function () {
const myUUID = crypto.randomUUID();
console.log(myUUID);
}
k6/experimental/webcrypto is deprecated and will be removed in v1.1.0.
k6 new command #4618The k6 new command now accepts a path to a file to use as a template for the new script. Templates use Go templates syntax and can include the following variables:
ScriptName: The name of the new script.ProjectID: The ID of the Grafana Cloud project to use for the new script.To generate a new script using a custom template, use the following command:
k6 new --template /path/to/my-template.js
We've added support for retrieving secrets from different sources. Among other things, this means that the values received from a secret source will be redacted from the logs. Refer to the documentation for more details.
The two implementations available are to read secrets from a key-value file or from CLI flags, which are meant mostly to test the feature. We've also included extension support, which can be used to implement retrieving secrets from more secure sources.
In the future, we'll likely include additional implementations that are more production-ready.
Here's an example where we log the secret directly, make a request, and then log the whole response. In both cases, the secrets are redacted from the logs.
import http from 'k6/http';
import secrets from 'k6/secrets';
export default async () => {
const my_secret = await secrets.get('cool'); // get secret from a source with the provided identifier
console.log(my_secret);
const response = await http.asyncRequest("GET", "https://httpbin.org/get", null, {
headers: {
"Custom-Authentication": `Bearer ${await secrets.get("else")}`,
}
})
console.log(response.body)
}
$ k6 run --secret-source=mock=cool="not cool secret",else="totally a secret" script.js
...
INFO[0000] ***SECRET_REDACTED*** source=console
INFO[0031] {
"args": {},
"headers": {
"Custom-Authentication": "Bearer ***SECRET_REDACTED***",
"Host": "httpbin.org",
"User-Agent": "k6/1.0.0-rc1 (https://k6.io/)",
"X-Amzn-Trace-Id": "Root=1-67dd6691-18eeaf5d1782bf292da5037c"
},
"origin": "1.1.1.1",
"url": "https://httpbin.org/get"
} source=console
...
docker-compose example with InfluxDB to the examples/docker-compose directory and adds an opentelemetry example.ReadableStream.cancel and run WPT test with race detection for easier finding of similar problems.ElementHandle, Mouse, Keyboard, and Response.Function.apply, logical assignment support, array destructuring in exports, better cross-os source map support.k6/timers reporting as always being used.lib.RuntimeOptions loading.latest docker image tag even for rc releases.