From f4de29dd87404c0585600b16f18a388488e2bf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 25 Sep 2023 10:34:40 +0200 Subject: [PATCH] setRunRequest: Allow changing multiple times from tests (#75346) setRunRequest: Allow changing multiple time from tests --- packages/grafana-runtime/src/services/QueryRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/grafana-runtime/src/services/QueryRunner.ts b/packages/grafana-runtime/src/services/QueryRunner.ts index ce472067bfe..424a765f4df 100644 --- a/packages/grafana-runtime/src/services/QueryRunner.ts +++ b/packages/grafana-runtime/src/services/QueryRunner.ts @@ -48,7 +48,7 @@ let runRequest: RunRequestFn | undefined; * @internal */ export function setRunRequest(fn: RunRequestFn): void { - if (runRequest) { + if (runRequest && process.env.NODE_ENV !== 'test') { throw new Error('runRequest function should only be set once, when Grafana is starting.'); } runRequest = fn;