grafana/packages/grafana-test-utils
Tom Ratcliffe 779295cfeb
Panels: Make getting started panel use app platform API (#112166)
2025-10-09 12:38:14 +01:00
..
src Panels: Make getting started panel use app platform API (#112166) 2025-10-09 12:38:14 +01:00
CHANGELOG.md
LICENSE_APACHE2
README.md Frontend: Move toEmit jest matchers to shared workspace (#108610) 2025-07-30 14:39:44 +02:00
jest-setup.js Frontend: Move toEmit jest matchers to shared workspace (#108610) 2025-07-30 14:39:44 +02:00
jest.config.js Frontend: Move toEmit jest matchers to shared workspace (#108610) 2025-07-30 14:39:44 +02:00
package.json Release: Bump version to 12.3.0-pre (#110974) 2025-09-12 17:54:11 +00:00
project.json
tsconfig.json Chore: Remove @grafana/tsconfig (#109186) 2025-08-06 15:34:34 +01:00

README.md

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.