-
-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathjest.config.js
More file actions
81 lines (76 loc) · 3.28 KB
/
Copy pathjest.config.js
File metadata and controls
81 lines (76 loc) · 3.28 KB
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
73
74
75
76
77
78
79
80
81
/** @type {import('jest').Config} */
const config = {
testEnvironment: 'jest-fixed-jsdom',
roots: ['<rootDir>/__tests__', '<rootDir>/test'],
moduleNameMapper: {
'^@app/(.*)$': '<rootDir>/app/$1',
'^@tests/(.*)': '<rootDir>/__tests__/$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
// use minified versions of d3 modules (prevents errors due Jest / ESM conflict)
'd3-array': '<rootDir>/node_modules/d3-array/dist/d3-array.min.js',
'd3-format': '<rootDir>/node_modules/d3-format/dist/d3-format.min.js',
'd3-scale': '<rootDir>/node_modules/d3-scale/dist/d3-scale.min.js',
'd3-shape': '<rootDir>/node_modules/d3-shape/dist/d3-shape.min.js',
'd3-time': '<rootDir>/node_modules/d3-time/dist/d3-time.min.js',
'd3-interpolate': '<rootDir>/node_modules/d3-interpolate/dist/d3-interpolate.min.js',
'd3-color': '<rootDir>/node_modules/d3-color/dist/d3-color.min.js',
'd3-path': '<rootDir>/node_modules/d3-path/dist/d3-path.min.js',
'd3-ease': '<rootDir>/node_modules/d3-ease/dist/d3-ease.min.js',
'd3-timer': '<rootDir>/node_modules/d3-timer/dist/d3-timer.min.js',
'd3-voronoi': '<rootDir>/node_modules/d3-voronoi/dist/d3-voronoi.min.js',
'd3-time-format': '<rootDir>/node_modules/d3-time-format/dist/d3-time-format.min.js',
// Path aliases
'.*/core/metricUtils(\\.js)?$': '<rootDir>/__mocks__/metricUtils.js',
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testMatch: [
'**/__tests__/**/*.test.[jt]s?(x)',
'<rootDir>/test/unit/**/*.test.[jt]s?(x)',
],
silent: true,
testTimeout: 15000,
transform: {
'^.+[\\\\/]node_modules[\\\\/].+\\.(js|jsx|ts|tsx)$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
},
},
],
'^.+\\.(js|jsx|ts|tsx)$': [
'@swc/jest',
{
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true,
},
transform: {
react: {
runtime: 'automatic',
},
},
target: 'es2020',
},
module: {
type: 'commonjs',
},
},
],
},
maxWorkers: '50%',
workerIdleMemoryLimit: '512MB',
transformIgnorePatterns: [
// This pattern ensures that @swc/jest transforms @tidepool/viz and all other dependencies.
// In the event that a `Jest failed to parse a file` error is encountered and it is a
// node_module, the module name can be added here to ensure pre-processing by @swc/jest.
'node_modules/(?!(.*\\.mjs$|@tidepool/viz|internmap|react-markdown|vfile|unist-util-stringify-position|unified|bail|is-plain-obj|trough|remark-parse|mdast-util-from-markdown|mdast-util-to-string|mdast-util-to-hast|micromark|decode-named-character-reference|remark-rehype|unist-util-position|trim-lines|unist-util-visit|unist-util-is|unist-util-generated|mdast-util-definitions|property-information|hast-util-whitespace|space-separated-tokens|comma-separated-tokens|@octokit|universal-user-agent|before-after-hook|sinon|cheerio|tideline|crypto-hash|reductio|keycloak-js|character-entities|until-async|uuid))',
],
};
module.exports = config;