From f2cb70b1e05f79772942985850c7d3f0219d8109 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Tue, 16 Dec 2025 12:04:11 +0000 Subject: [PATCH] add MessageChannel mock to grafana-plugin-configs --- .../grafana-plugin-configs/jest/jest-setup.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/grafana-plugin-configs/jest/jest-setup.js b/packages/grafana-plugin-configs/jest/jest-setup.js index 05a2b03634c..d0506f592a7 100644 --- a/packages/grafana-plugin-configs/jest/jest-setup.js +++ b/packages/grafana-plugin-configs/jest/jest-setup.js @@ -84,3 +84,19 @@ global.ResizeObserver = class ResizeObserver { this.#isObserving = false; } }; + +global.MessageChannel = jest.fn().mockImplementation(() => { + let onmessage; + return { + port1: { + set onmessage(cb) { + onmessage = cb; + }, + }, + port2: { + postMessage: (data) => { + onmessage?.({ data }); + }, + }, + }; +});