* test(frontend): ignore azuremonitor tests in root jest config * test(loki): increase waitfor in monacofieldwrapper test * feat(plugin-configs): introduce jest config * feat(azuremonitor): add jest config and test scripts * ci(pr-frontend-unit-tests): introduce separate decoupled plugin test job * ci(pr-frontend-unit-tests): run decoupled-plugin tests regardless of fork * Wip * test(decoupled-plugins): decouple tests in all plugins except loki and mssql * test(frontend): ignore decoupled plugins that run their own tests * test(stackdriver): update snapshot due to reactinlinesvg mock difference * chore(yarn): update lock file * chore(plugin-configs): remove create-plugin comments * ci(frontend-unit-tests): make them run on pr or merge to main * chore(decoupled-plugins): add plugin:test:ci command for locally running all tests * ci(frontend-unit-tests): run test:ci instead of calling nx directly * chore(decoupled-plugins): fix jest-dom types for loki and testdata
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
process.env.TZ = 'Pacific/Easter'; // UTC-06:00 or UTC-05:00 depending on daylight savings
|
|
|
|
import path from 'path';
|
|
|
|
import { grafanaESModules, nodeModulesToTransform } from './utils.js';
|
|
|
|
export default {
|
|
moduleNameMapper: {
|
|
'\\.(css|scss|sass)$': 'identity-obj-proxy',
|
|
'react-inlinesvg': path.resolve(import.meta.dirname, 'mocks', 'react-inlinesvg.tsx'),
|
|
'\\.(svg|png|jpg)': path.resolve(import.meta.dirname, 'mocks', 'images.ts'),
|
|
'^monaco-editor$': 'monaco-editor/esm/vs/editor/editor.api.js',
|
|
'@kusto/monaco-kusto': '@kusto/monaco-kusto/release/esm/monaco.contribution.js',
|
|
},
|
|
modulePaths: ['<rootDir>'],
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'cjs'],
|
|
setupFiles: ['jest-canvas-mock'],
|
|
setupFilesAfterEnv: ['<rootDir>/jest-setup.js'],
|
|
testEnvironment: 'jsdom',
|
|
testMatch: ['<rootDir>/**/__tests__/**/*.{js,jsx,ts,tsx}', '<rootDir>/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'],
|
|
transform: {
|
|
'^.+\\.(t|j)sx?$': [
|
|
'@swc/jest',
|
|
{
|
|
sourceMaps: 'inline',
|
|
jsc: {
|
|
parser: {
|
|
syntax: 'typescript',
|
|
tsx: true,
|
|
decorators: false,
|
|
dynamicImport: true,
|
|
},
|
|
transform: {
|
|
react: {
|
|
runtime: 'automatic',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
// Jest will throw `Cannot use import statement outside module` if it tries to load an
|
|
// ES module without it being transformed first. ./config/README.md#esm-errors-with-jest
|
|
transformIgnorePatterns: [nodeModulesToTransform(grafanaESModules)],
|
|
watchPathIgnorePatterns: ['<rootDir>/node_modules', '<rootDir>/dist'],
|
|
};
|