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-10-04 05:12:30 -05:00
|
|
|
const esModules = ['ol', 'd3', 'd3-color', 'd3-interpolate', 'delaunator', 'internmap', 'robust-predicates'].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
|
|
|
],
|
2022-05-30 08:14:34 -05:00
|
|
|
moduleDirectories: ['public'],
|
2022-02-16 07:15:31 -06:00
|
|
|
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages'],
|
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',
|
2020-09-03 01:54:46 -05:00
|
|
|
'monaco-editor/esm/vs/editor/editor.api': '<rootDir>/public/test/mocks/monaco.ts',
|
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' }]],
|
2017-10-22 00:03:26 -05:00
|
|
|
};
|