forked from deephaven/deephaven-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.base.cjs
72 lines (70 loc) · 1.78 KB
/
jest.config.base.cjs
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
67
68
69
70
71
72
const path = require('path');
// List of node_modules that need to be transformed from ESM to CJS for jest to work
const nodeModulesToTransform = [
'@deephaven',
'nanoid',
// monaco
'monaco-editor',
// plotly.js dependencies
'd3-interpolate',
'd3-color',
// react-markdown and its dependencies
'react-markdown',
'vfile',
'vfile-message',
'unist-util.*',
'unified',
'bail',
'is-plain-obj',
'trough',
'remark.*',
'mdast-util.*',
'micromark.*',
'decode-named-character-reference',
'trim-lines',
'property-information',
'hast-util.*',
'.*separated-tokens',
'ccount',
'devlop',
'escape-string-regexp',
'markdown-table',
'zwitch',
'longest-streak',
'rehype.*',
'web-namespaces',
'hastscript',
'@astral-sh/ruff-wasm-web',
];
module.exports = {
transform: {
'^.+\\.(ts|tsx|js|jsx)$': ['babel-jest', { rootMode: 'upward' }],
},
transformIgnorePatterns: [
`node_modules/(?!(${nodeModulesToTransform.join('|')})/)`,
],
moduleNameMapper: {
'theme-([^/]+?)\\.css(\\?(?:inline|raw))?$': path.join(
__dirname,
'./__mocks__/mockTheme.js'
),
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
path.join(__dirname, './__mocks__/fileMock.js'),
'^fira$': 'identity-obj-proxy',
'^monaco-editor$': path.join(
__dirname,
'node_modules',
'monaco-editor/esm/vs/editor/editor.api.js'
),
// Handle monaco worker files
'\\.worker.*$': 'identity-obj-proxy',
// All packages use src/js/src code
'^@deephaven/js-plugin-(.*)$': path.join(
__dirname,
'./plugins/$1/src/js/src'
),
},
testEnvironment: 'jsdom',
setupFilesAfterEnv: [path.join(__dirname, './jest.setup.ts')],
};