Skip to content

Update module go.k6.io/k6 to v1 #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elastic-renovate-prod[bot]
Copy link
Contributor

This PR contains the following updates:

Package Type Update Change
go.k6.io/k6 require major v0.56.0 -> v1.0.0

Release Notes

grafana/k6 (go.k6.io/k6)

v1.0.0

Compare Source

Grafana k6 v1.0 is here! 🎉

After 9 years of iteration and countless community contributions, we're thrilled to announce Grafana k6 v1.0.

While many features and capabilities in this release were introduced gradually in previous versions, k6 v1.0 marks a turning point: a commitment to stability, formal support guarantees, and transparency in how we evolve and develop the project from here. This milestone is more than a version number; it's about trust, reliability, and empowering you to test confidently.

Thank you, k6 community! 🌍

This release wouldn't be possible without you:

  • ⭐️ 27000+ GitHub stars.
  • 🧠 9000+ git commits.
  • 🤝 200+ contributors.
  • 🔁 Countless test runs of any scale, in every timezone.

It's been amazing to watch k6 grow from a simple load testing command-line tool into a comprehensive reliability tool, used by teams worldwide and supported by a passionate and dedicated community.

To everyone who filed bugs, built extensions and libraries, or championed k6:️
Thank you! You've shaped what k6 is today. 🙇‍♂️

What's New in k6 1.0?

1. Stability You Can Build On
  • Semantic Versioning: k6 now follows Semantic Versioning 2.0. Breaking changes will only happen in major releases, with prior deprecation warnings.
  • 🔒 2-Year Support Guarantees: Every major version will be supported with critical fixes for at least two years; upgrade on your schedule.
  • 📦 Public API Surface: We've established a clearly delineated and supported API surface for the k6 codebase. Extensions, integrations, and projects building on top of the k6 code now have a stable foundation to rely on.

🔎 Read more in our versioning and stability guarantees guide.

2. First-Class TypeScript Support

Write type-safe and maintainable tests—no transpilation needed. Simply save your file with a .ts extension and run it directly using k6 run script.ts.

import http from 'k6/http';  

// PizzaRequest defines the request body format the quickpizza API expects
export interface PizzaRequest {
    maxCaloriesPerSlice: number;
    mustBeVegetarian: boolean;
}

export default function () {  
    const payload: PizzaRequest = {
        maxCaloriesPerSlice: 500, // Type-checked!  
        mustBeVegetarian: true,
    }

  http.post(
    'https://quickpizza.grafana.com/api/pizza',
    JSON.stringify(payload),
    { 
        headers: { 
          "Content-Type": "application/json",
          "Authorization": "Token " + "abcdef0123456789"
        } as Record<string, string>
    });  
}  
3. Extensions Made Simple

With k6 v1.0, extensions now work out of the box in k6 cloud run and k6 cloud run --local-execution. Support for k6 run is coming soon.

✅ No more xk6 toolchain.
✅ No manual builds.
✅ Import an extension's module and go.

import faker from 'k6/x/faker';

export default function () {
  console.log(faker.person.firstName());
}

To try the experimental feature, first enable its feature flag, then run it on Grafana Cloud with the following command:

K6_BINARY_PROVISIONING=true k6 cloud run script.js,

or if you want to run it locally and stream the results to Grafana Cloud then use:

K6_BINARY_PROVISIONING=true k6 cloud run --local-execution script.js
4. Revamped test summary

The new end-of-test summary makes it easier to understand results and spot issues:

  • 📊 Hierarchical output: Metrics are grouped by scenario, group, and category.
  • Improved thresholds & checks: Clearer layout for faster debugging.
  • 🔍 Multiple summary modes:
    • compact (default): big picture results, focusing on essentials.
    • full: full picture results, providing granularity.
k6 run --summary-mode=full script.ts

end-of-test-summary

5. Quality of Life Upgrades
  • Stable modules: k6/browser, k6/net/grpc, and k6/crypto are now production-ready.
  • Improved Grafana Cloud integration: Stream local test results to Grafana Cloud with k6 cloud run --local-execution.

v0.59.0

Compare Source

The v0.59.0 release mirrors the previous v1.0.0-rc2 release 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 under v0.* for necessary release candidates.

This practice will end once the official stable v1.0.0 release 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.0 and are now part of this version.

v0.58.0

Compare Source

The v0.58.0 release mirrors the previous v1.0.0-rc1 release 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 under v0.* for necessary release candidates.

This practice will end once the official stable v1.0.0 release 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.0 and are now part of this version.

v0.57.0

Compare Source

k6 v0.57.0 is here 🎉! This release includes:

  • Introducing helpers for functional testing.
  • The k6 new command now supports templates and ProjectIDs.
  • The k6/experimental/csv module gets a new asObjects option.
  • We no longer support the k6/experimental/browser module, in favor of k6/browser.
  • Moving most of non-public APIs to the internal package.

Breaking changes

  • #​4161 Drops k6/experimental/browser. If you're still using it, follow the instructions to move to the graduated and stable k6/browser module.
  • #​4133 Moves all not publicly used APIs in internal package. 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.
  • #​4292 TypeScript is automatically supported and recognized if the script files use the .ts extension. It also deprecates experimental_enhanced compatibility 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 expect function, with which assertions can be performed using specific matchers that reflect the expected results.
Unlike current k6's check when expects assertions 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, or toBeTruthy, to only name a few, that can be used to assert conditions during a k6 test.

import { expect } from 'https://jslib.k6.io/k6-testing/0.2.0/index.js';

export default function () {
    const response = http.get('https://test.k6.io');
    expect(response.status).toEqual(200);
    expect(response.body).toBeTruthy();
    expect(response.json()).toEqual(JSON.stringify({ message: 'Hello, world!' }));
}

k6-jslib-testing also includes browser-specific async matchers that wait until the expected condition is met such as toBeVisible, toBeDisabled, or toBeChecked, to name a few.

import { expect } from "https://jslib.k6.io/k6-testing/0.2.0/index.js";
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();

  try {
    // Navigate to the page
    await page.goto("https://test.k6.io/my_messages.php");

    // Type into the login input field: 'testlogin'
    const loc = await page.locator('input[name="login"]');
    await loc.type("testlogin");

    // Assert that the login input field is visible
    await expect(page.locator('input[name="login"]')).toBeVisible();

    // Expecting this to fail as we have typed 'testlogin' into the input instead of 'foo'
    await expect(page.locator('input[name="login"]')).toHaveValue("foo");
  } finally {
    await page.close();
  }
}

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:

import { expect } from "https://jslib.k6.io/k6-testing/0.2.0/index.js";

Try it out and give us feedback or contribute to the project on the k6-jslib-testing repository!

--template and --project-id flags for k6 new command #​4153

The k6 new command has been revamped to provide an improved experience when scaffolding new k6 tests. It now supports a --template flag with options such as minimal, protocol, and browser, letting you generate a script tailored to your specific use case.

The command also now accepts a --project-id flag, which allows you to easily parameterize the test's Grafana Cloud configuration.

### Create a new k6 script using the 'protocol' template
$ k6 new --template protocol

### Create a Grafana k6 cloud-ready script with a specific project ID
$ k6 new --project-id 12345
New asObjects option in k6/experimental/csv module #​4295

The CSV module's parsing operations now support the asObjects option, which enables parsing CSV data into JavaScript objects instead of arrays of strings (the default behavior).

When asObjects is set to true, the module parses CSV data into objects where:

  • Column names from the header row become object keys.
  • Column values become the corresponding object values.
  • An error is thrown if no header row exists or if options modify the parsing start point.

With the option set to true,

import http from 'k6/http';
import csv from 'k6/experimental/csv';

const csvData = csv.parse('data.csv', { asObjects: true });

the following CSV file:

name,age,city
John,30,New York
Jane,25,Los Angeles

will be parsed into the following JavaScript objects:

[
  { name: 'John', age: '30', city: 'New York' },
  { name: 'Jane', age: '25', city: 'Los Angeles' },
]

Refer to the CSV module's documentation for more information.

UX improvements and enhancements

  • #​4176 Warns on using shorthand options when that override scenarios.
  • #​4293 Renames browser data directory name prefix from xk6-browser-data- to k6browser-data-.
  • #​4513 Adds support for file scheme URLs across file loading APIs - open, k6/experimental/fs.open and k6/net/grpc.Client#load.
  • #​4517 Switches from the legacy examples to quickpizza.grafana.com.

Bug fixes

Maintenance and internal improvements

  • #​4184 Fixes some browser Windows tests.
  • #​4131 Moves experimental WebSocket code into the k6 codebase.
  • #​4143 Fixes for k6packager workflow building image to do k6 releases.
  • #​4172 Drops Slack URL from the README.
  • #​4173 Updates dependencies in gRPC example server.
  • #​4187 Removes packaging folder from browser module - not needed after it was moved to the k6 codebase.
  • #​4188, #​4190 Merge xk6-webcrypto extension code into k6.
  • #​4189 Uses modulestest to make experimental streams test simpler.
  • #​4191 Removes BaseEventEmitter from components that don't work with it.
  • #​4201 Tracks more dependencies to dependabot.
  • #​4212 Fixes gRPC tests after update to golang internal test certificates.
  • #​4213 Updates k6-taskqueue-lib to v0.1.3.
  • #​4271 Runs dependabot weekly instead of daily.
  • #​4275 Fixes the browser module working with reused VUs that originally weren't used in browser scenarios.
  • #​4276 REST API stays on while outputs are flushing, only stopping after that.
  • #​4294 TestStreamLogsToLogger: increase wait time to get less flakiness.
  • #​4209, #​4208, #​4196, #​4195, #​4193, #​4177, #​4163, #​4151, #​4213 Update direct dependencies.
  • #​4198 Adds a multiple forward-slash test case. Thanks, @​apatruni, for the contribution!
  • #​4504, #​4506 Update the golangci-lint version.
  • #​4298 Adds test coverage for configuration file's operations.

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.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

@elastic-renovate-prod
Copy link
Contributor Author

ℹ Artifact update notice

File name: go.mod

In order to perform the update(s) described in the table above, Renovate ran the go get command, which resulted in the following additional change(s):

  • 19 additional dependencies were updated
  • The go directive was updated for compatibility reasons

Details:

Package Change
go 1.23.6 -> 1.24.3
golang.org/x/time v0.8.0 -> v0.11.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 -> v2.26.1
github.com/mailru/easyjson v0.7.7 -> v0.9.0
github.com/mattn/go-colorable v0.1.13 -> v0.1.14
go.opentelemetry.io/otel v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/metric v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/sdk v1.29.0 -> v1.35.0
go.opentelemetry.io/otel/trace v1.29.0 -> v1.35.0
go.opentelemetry.io/proto/otlp v1.3.1 -> v1.5.0
golang.org/x/net v0.33.0 -> v0.39.0
golang.org/x/sys v0.28.0 -> v0.32.0
golang.org/x/text v0.21.0 -> v0.24.0
google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd -> v0.0.0-20250218202821-56aae31c358a
google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd -> v0.0.0-20250218202821-56aae31c358a
google.golang.org/grpc v1.67.1 -> v1.71.1
google.golang.org/protobuf v1.35.1 -> v1.36.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants