2020-10-20 10:41:47 -05:00
|
|
|
// We set this specifically for 2 reasons.
|
|
|
|
// 1. It makes sense for both CI tests and local tests to behave the same so issues are found earlier
|
|
|
|
// 2. Any wrong timezone handling could be hidden if we use UTC/GMT local time (which would happen in CI).
|
2023-04-17 10:19:44 -05:00
|
|
|
process.env.TZ = 'Pacific/Easter'; // UTC-06:00 or UTC-05:00 depending on daylight savings
|
2020-09-17 01:59:20 -05:00
|
|
|
|
2023-12-20 07:14:57 -06:00
|
|
|
const esModules = [
|
2024-01-25 04:52:49 -06:00
|
|
|
'@glideapps/glide-data-grid',
|
2023-12-20 07:14:57 -06:00
|
|
|
'ol',
|
|
|
|
'd3',
|
|
|
|
'd3-color',
|
|
|
|
'd3-interpolate',
|
|
|
|
'delaunator',
|
|
|
|
'internmap',
|
|
|
|
'robust-predicates',
|
|
|
|
'leven',
|
2024-01-12 08:05:46 -06:00
|
|
|
'nanoid',
|
2024-02-05 13:46:35 -06:00
|
|
|
'monaco-promql',
|
2024-02-22 05:31:40 -06:00
|
|
|
'@kusto/monaco-kusto',
|
|
|
|
'monaco-editor',
|
2024-05-28 10:04:03 -05:00
|
|
|
'@msagl',
|
2024-02-22 05:31:40 -06:00
|
|
|
'lodash-es',
|
2024-03-26 11:10:06 -05:00
|
|
|
'vscode-languageserver-types',
|
2023-12-20 07:14:57 -06:00
|
|
|
].join('|');
|
2023-01-26 06:02:22 -06:00
|
|
|
|
2017-10-22 00:03:26 -05:00
|
|
|
module.exports = {
|
2017-11-17 09:18:30 -06:00
|
|
|
verbose: false,
|
2021-12-03 11:09:25 -06:00
|
|
|
testEnvironment: 'jsdom',
|
2020-02-13 14:37:24 -06:00
|
|
|
transform: {
|
2022-11-24 08:00:41 -06:00
|
|
|
'^.+\\.(ts|tsx|js|jsx)$': [require.resolve('ts-jest'), { isolatedModules: true }],
|
2017-10-22 00:03:26 -05:00
|
|
|
},
|
2021-07-15 14:00:19 -05:00
|
|
|
transformIgnorePatterns: [
|
2023-01-26 06:02:22 -06:00
|
|
|
`/node_modules/(?!${esModules})`, // exclude es modules to prevent TS complaining
|
2021-07-15 14:00:19 -05:00
|
|
|
],
|
2024-04-15 10:41:52 -05:00
|
|
|
moduleDirectories: ['public', 'node_modules'],
|
2024-03-21 05:36:37 -05:00
|
|
|
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages', '<rootDir>/scripts/tests'],
|
2020-02-13 14:37:24 -06:00
|
|
|
testRegex: '(\\.|/)(test)\\.(jsx?|tsx?)$',
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
2023-05-15 03:15:26 -05:00
|
|
|
setupFiles: ['jest-canvas-mock', './public/test/jest-setup.ts'],
|
2021-05-19 05:40:10 -05:00
|
|
|
testTimeout: 30000,
|
2022-05-30 08:14:34 -05:00
|
|
|
resolver: `<rootDir>/public/test/jest-resolver.js`,
|
2020-08-20 08:21:42 -05:00
|
|
|
setupFilesAfterEnv: ['./public/test/setupTests.ts'],
|
2021-04-23 02:06:19 -05:00
|
|
|
globals: {
|
|
|
|
__webpack_public_path__: '', // empty string
|
|
|
|
},
|
2020-05-04 08:05:31 -05:00
|
|
|
moduleNameMapper: {
|
|
|
|
'\\.svg': '<rootDir>/public/test/mocks/svg.ts',
|
2020-06-29 12:58:47 -05:00
|
|
|
'\\.css': '<rootDir>/public/test/mocks/style.ts',
|
2023-10-24 06:16:32 -05:00
|
|
|
'react-inlinesvg': '<rootDir>/public/test/mocks/react-inlinesvg.tsx',
|
2024-02-22 05:31:40 -06:00
|
|
|
// resolve directly as monaco and kusto don't have main property in package.json which jest needs
|
|
|
|
'^monaco-editor$': 'monaco-editor/esm/vs/editor/editor.api.js',
|
|
|
|
'@kusto/monaco-kusto': '@kusto/monaco-kusto/release/esm/monaco.contribution.js',
|
2023-06-05 03:51:36 -05:00
|
|
|
// near-membrane-dom won't work in a nodejs environment.
|
|
|
|
'@locker/near-membrane-dom': '<rootDir>/public/test/mocks/nearMembraneDom.ts',
|
2023-07-05 09:24:48 -05:00
|
|
|
'^@grafana/schema/dist/esm/(.*)$': '<rootDir>/packages/grafana-schema/src/$1',
|
2023-08-31 08:45:44 -05:00
|
|
|
// prevent systemjs amd extra from breaking tests.
|
|
|
|
'systemjs/dist/extras/amd': '<rootDir>/public/test/mocks/systemjsAMDExtra.ts',
|
2020-05-04 08:05:31 -05:00
|
|
|
},
|
2022-12-27 05:06:06 -06:00
|
|
|
// Log the test results with dynamic Loki tags. Drone CI only
|
|
|
|
reporters: ['default', ['<rootDir>/public/test/log-reporter.js', { enable: process.env.DRONE === 'true' }]],
|
2024-03-21 06:54:19 -05:00
|
|
|
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
|
2017-10-22 00:03:26 -05:00
|
|
|
};
|