-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
41 lines (35 loc) · 1.26 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
/** @type {import('ts-jest').JestConfigWithTsJest} */const path = require('path');
const esModules = ['d3-selection', 'd3-array', 'd3-scale', 'd3-path', 'd3-zoom', 'd3-shape', 'd3-hierarchy', 'd3-ease']
const moduleNameMappers = esModules.reduce((acc, pkg) => {
acc[`^${pkg}$`] = path.join(require.resolve(pkg), `../../dist/${pkg}.min.js`);
return acc;
}, {});
module.exports = {
roots: ['<rootDir>/tests'],
testEnvironment: './tests/fixJsDomEnv.ts',
extensionsToTreatAsEsm: ['.ts',
'.min.js'],
setupFilesAfterEnv: ['@testing-library/jest-dom'],
setupFiles: ['./tests/setupTests.ts', "fake-indexeddb/auto"],
moduleNameMapper: {
// '^@apollo/client$': '<rootDir>/tests/apollo.cjs',
"\\.(css|less|graphql)$": "<rootDir>/tests/styleMock.js",
"\\.(svg\.raw\?)$": "<rootDir>/tests/svgTransform.ts",
...moduleNameMappers,
"^(\\.{1,2}/.*)\\.js$": "$1",
},
transformIgnorePatterns: [
`node_modules/(?!(${esModules.join("|")}))`,
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
tsConfig: '<rootDir>/tests/tsconfig.json',
}
],
"^.+\\.svg.+$": "<rootDir>/tests/svgTransform.ts",
'^.+\\.js?$': ['babel-jest'],
'^jotai-minidb$': 'ts-jest',
"\\.(gql|graphql)$": "jest-transform-graphql",
},
};