setRunRequest: Allow changing multiple times from tests (#75346)

setRunRequest: Allow changing multiple time from tests
This commit is contained in:
Torkel Ödegaard 2023-09-25 10:34:40 +02:00 committed by GitHub
parent 11d2938387
commit f4de29dd87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ let runRequest: RunRequestFn | undefined;
* @internal * @internal
*/ */
export function setRunRequest(fn: RunRequestFn): void { 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.'); throw new Error('runRequest function should only be set once, when Grafana is starting.');
} }
runRequest = fn; runRequest = fn;