Files
grafana/packages/grafana-test-utils
grafana-delivery-bot[bot] afc536118d Release: Bump version to 12.3.0-pre (#110974)
* update bump-version

* Add id-token: write

* update generate-token step

* pull-requests -> pull_requests

* clone with token and set right name

* bump version 12.3.0-pre

---------

Co-authored-by: Kevin Minehart <5140827+kminehart@users.noreply.github.com>
Co-authored-by: grafana-delivery-bot[bot] <grafana-delivery-bot[bot]@users.noreply.github.com>
2025-09-12 17:54:11 +00:00
..

Grafana test utils

This package is a collection of test utils and a mock API (using MSW) for use with core Grafana UI development.

Matchers

To add the matchers to your Jest config, import them then extend expect. This should be done in the setupFilesAfterEnv file declared in jest.config.{js,ts}.

// setupTests.ts
import { matchers } from '@grafana/test-utils';

expect.extend(matchers);

Included in this package are the following matchers:

toEmitValues

Tests that an Observable emits the expected values in the correct order. This matcher collects all emitted values (including errors) and compares them against the expected array using deep equality.

toEmitValuesWith

Tests that an Observable emits values that satisfy custom expectations. This matcher collects all emitted values and passes them to a callback function where you can perform custom assertions.