2020-10-20 23:41:47 +08: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 23:19:44 +08:00
|
|
|
process.env.TZ = 'Pacific/Easter'; // UTC-06:00 or UTC-05:00 depending on daylight savings
|
2020-09-17 14:59:20 +08:00
|
|
|
|
2023-12-20 21:14:57 +08:00
|
|
|
const esModules = [
|
2024-01-25 18:52:49 +08:00
|
|
|
'@glideapps/glide-data-grid',
|
2023-12-20 21:14:57 +08:00
|
|
|
'ol',
|
|
|
|
'd3',
|
|
|
|
'd3-color',
|
|
|
|
'd3-interpolate',
|
|
|
|
'delaunator',
|
|
|
|
'internmap',
|
|
|
|
'robust-predicates',
|
|
|
|
'leven',
|
2024-01-12 22:05:46 +08:00
|
|
|
'nanoid',
|
Prometheus: Create Prometheus library (#81641)
* Move to the library
* copy from library
* move them in src
* have additional files
* add unmigrated/dulicated code and files
* migrate from brendan's pr
module.ts, query_hints.ts, tracking.ts, and remove plugin.json
* migrate from brendan's pr
metric_find_query.test.ts
* migrate from brendan's pr
language_utils.test.ts
* migrate from brendan's pr
index.ts in root and in configuration
* migrate from brendan's pr
datasource.test.ts
* migrate from brendan's pr
typings folder
* migrate from brendan's pr
querycache folder
* migrate from brendan's pr
monaco-query-field folder
* migrate from brendan's pr
components folder without monaco-query-field folder
* migrate from brendan's pr
configuration/overhaul folder
* migrate from brendan's pr
AlertingSettingsOverhaul.tsx
* Remove azure related code
* migrate from brendan's pr
ConfigEditor.tsx, DataSourceHttpSettingsOverhaul.tsx, ExemplarSetting.tsx, configuration/mocks.ts, PromSettings.test.tsx, PromSettings.tsx
* migrate from brendan's pr
useFlag.ts
* migrate from brendan's pr
metrics-modal folder
* migrate from brendan's pr
files inside components folder
* migrate from brendan's pr
LabelFilters* files because they are now under components folder
* migrate from brendan's pr
files under querybuilder/shared folder
* migrate from brendan's pr
aggregations.ts, QueryPattern.tsx, QueryPatternsModal.tsx, state.ts, testUtils.ts under querybuilder folder
* Apply Ivana's PR https://github.com/grafana/grafana/pull/81656
* Apply jack's suggestions in this PR https://github.com/grafana/grafana/pull/77762
* Apply Ivana's PR https://github.com/grafana/grafana/pull/81656
* Fix type import
* add monaco-promql to transformIgnorePatterns to run prometheus frontend library tests
* remove Loki specific tests because we removed Loki code to decouple Loki
* add prometheus specific references
* We are moving these betterer issues from core Prometheus to the Library and we promise to remove all issues in the future, thank you
* include prometheus library in package.json
* add yarn lock with prometheus frontend library
* decouple final core import from metric_find_query.test.ts
* run prettier
* fix core imports in promqail
* fix lint errors
* run prettier
* add grafana-ui to devdeps to fix lint errors
* update yarn.lock
* grafana-ui fix
* trying to fix grafana-ui type errors with lerna drone check
* trying to fix grafana-ui type errors with lerna drone check
* trying to fix grafana-ui type errors with lerna drone check
* trying to fix grafana-ui type errors with lerna drone check
* try to pass typecheck
---------
Co-authored-by: Brendan O'Handley <brendan.ohandley@grafana.com>
2024-02-02 22:30:14 +08:00
|
|
|
'monaco-promql'
|
2023-12-20 21:14:57 +08:00
|
|
|
].join('|');
|
2023-01-26 20:02:22 +08:00
|
|
|
|
2017-10-22 13:03:26 +08:00
|
|
|
module.exports = {
|
2017-11-17 23:18:30 +08:00
|
|
|
verbose: false,
|
2021-12-04 01:09:25 +08:00
|
|
|
testEnvironment: 'jsdom',
|
2020-02-14 04:37:24 +08:00
|
|
|
transform: {
|
2022-11-24 22:00:41 +08:00
|
|
|
'^.+\\.(ts|tsx|js|jsx)$': [require.resolve('ts-jest'), { isolatedModules: true }],
|
2017-10-22 13:03:26 +08:00
|
|
|
},
|
2021-07-16 03:00:19 +08:00
|
|
|
transformIgnorePatterns: [
|
2023-01-26 20:02:22 +08:00
|
|
|
`/node_modules/(?!${esModules})`, // exclude es modules to prevent TS complaining
|
2021-07-16 03:00:19 +08:00
|
|
|
],
|
2024-01-29 22:27:35 +08:00
|
|
|
moduleDirectories: ['public', 'node_modules'],
|
2022-02-16 21:15:31 +08:00
|
|
|
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages'],
|
2020-02-14 04:37:24 +08:00
|
|
|
testRegex: '(\\.|/)(test)\\.(jsx?|tsx?)$',
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
2023-05-15 16:15:26 +08:00
|
|
|
setupFiles: ['jest-canvas-mock', './public/test/jest-setup.ts'],
|
2021-05-19 18:40:10 +08:00
|
|
|
testTimeout: 30000,
|
2022-05-30 21:14:34 +08:00
|
|
|
resolver: `<rootDir>/public/test/jest-resolver.js`,
|
2020-08-20 21:21:42 +08:00
|
|
|
setupFilesAfterEnv: ['./public/test/setupTests.ts'],
|
2021-04-23 15:06:19 +08:00
|
|
|
globals: {
|
|
|
|
__webpack_public_path__: '', // empty string
|
|
|
|
},
|
2020-05-04 21:05:31 +08:00
|
|
|
moduleNameMapper: {
|
|
|
|
'\\.svg': '<rootDir>/public/test/mocks/svg.ts',
|
2020-06-30 01:58:47 +08:00
|
|
|
'\\.css': '<rootDir>/public/test/mocks/style.ts',
|
2023-10-24 19:16:32 +08:00
|
|
|
'react-inlinesvg': '<rootDir>/public/test/mocks/react-inlinesvg.tsx',
|
2020-09-03 14:54:46 +08:00
|
|
|
'monaco-editor/esm/vs/editor/editor.api': '<rootDir>/public/test/mocks/monaco.ts',
|
2023-06-05 16:51:36 +08:00
|
|
|
// near-membrane-dom won't work in a nodejs environment.
|
|
|
|
'@locker/near-membrane-dom': '<rootDir>/public/test/mocks/nearMembraneDom.ts',
|
2023-07-05 22:24:48 +08:00
|
|
|
'^@grafana/schema/dist/esm/(.*)$': '<rootDir>/packages/grafana-schema/src/$1',
|
2023-08-31 21:45:44 +08:00
|
|
|
// prevent systemjs amd extra from breaking tests.
|
|
|
|
'systemjs/dist/extras/amd': '<rootDir>/public/test/mocks/systemjsAMDExtra.ts',
|
2020-05-04 21:05:31 +08:00
|
|
|
},
|
2022-12-27 19:06:06 +08: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 13:03:26 +08:00
|
|
|
};
|