From 44c0a2ebc2691a2741d98e41ea1382181a422a34 Mon Sep 17 00:00:00 2001 From: idastambuk Date: Tue, 10 Dec 2024 12:05:02 +0100 Subject: [PATCH] Add monaco-promql to transform --- jest-setup.js | 24 ++++++++++++------------ jest.config.js | 5 ++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/jest-setup.js b/jest-setup.js index 0b53a8dc..f40a4540 100644 --- a/jest-setup.js +++ b/jest-setup.js @@ -10,17 +10,17 @@ import { matchers } from './src/matchers'; expect.extend(matchers); window.MessageChannel = jest.fn().mockImplementation(() => { - let onmessage; - return { - port1: { - set onmessage(cb) { - onmessage = cb; - }, + let onmessage; + return { + port1: { + set onmessage(cb) { + onmessage = cb; }, - port2: { - postMessage: data => { - onmessage?.({ data }); - }, + }, + port2: { + postMessage: (data) => { + onmessage?.({ data }); }, - }; - }); \ No newline at end of file + }, + }; +}); diff --git a/jest.config.js b/jest.config.js index 79fd52a1..7e00a778 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,8 +1,11 @@ // force timezone to UTC to allow tests to work regardless of local timezone // generally used by snapshots, but can affect specific tests process.env.TZ = 'UTC'; +const { grafanaESModules, nodeModulesToTransform } = require('./.config/jest/utils'); module.exports = { - // Jest configuration provided by Grafana scaffolding + // Jest configuration provided by @grafana/create-plugin ...require('./.config/jest.config'), + // Inform Jest to only transform specific node_module packages. + transformIgnorePatterns: [nodeModulesToTransform([...grafanaESModules, 'monaco-promql'])], };