-
Notifications
You must be signed in to change notification settings - Fork 14
/
jest.config.js
66 lines (63 loc) · 1.65 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 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';
// Jest configuration provided by @grafana/create-plugin
const originalConfig = require('./.config/jest.config');
const { grafanaESModules, nodeModulesToTransform } = require('./.config/jest/utils');
// jest will import the esmodules bundle of these packages which need transforming
// prior to tests running
const esModules = [
'@awsui',
'@babel/runtime',
'@iot-app-kit',
'@matterport',
'@react-three',
'3d-tiles-renderer',
'bail',
'comma-separated-tokens',
'decode-named-character-reference',
'hast-util.*',
'is-absolute-url',
'is-plain-obj',
'mdast-util.*',
'micromark.*',
'property-information',
'react-markdown',
'react-router-dom',
'react-router',
'rehype-sanitize',
'remark.*',
'rxjs',
'space-separated-tokens',
'three',
'trough',
'trim-lines',
'unified',
'unist-util.*',
'vfile.*',
'@cloudscape-design',
'@popperjs',
'@react-dnd',
'd3-format',
'd3-array',
'dnd-core',
'internmap',
'react-cytoscapejs',
'react-dnd',
'react-dnd-html5-backend',
'echarts',
'zrender',
'nanoid',
'@iot-app-kit/react-components',
];
module.exports = {
resolver: `<rootDir>/tests/utils/resolver.js`,
...originalConfig,
// Inform jest to only transform specific node_module packages.
transformIgnorePatterns: [nodeModulesToTransform([...grafanaESModules, ...esModules])],
moduleNameMapper: {
...originalConfig.moduleNameMapper,
'\\.(hdr)$': '<rootDir>/tests/utils/__mocks__/styleMock.js',
'\\.(svg)$': 'jest-transform-stub'
},
};