diff --git a/jest-setup.js b/jest-setup.js index 0b53a8d..f40a454 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 79fd52a..7e00a77 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'])], };