forked from Vero-protocol/vero-guardian-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
40 lines (36 loc) · 1.13 KB
/
Copy pathjest.config.js
File metadata and controls
40 lines (36 loc) · 1.13 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
const nextJest = require('next/jest');
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
});
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
// Handle module aliases (this will be automatically configured from tsconfig.json)
'^@/(.*)$': '<rootDir>/src/$1',
},
};
// D3 ships ESM-only packages that Jest must transform. next/jest sets its own
// transformIgnorePatterns, so override it after the async config is built to
// whitelist the d3 modules used by the gas heatmap.
const d3EsmModules = [
'd3-scale',
'd3-scale-chromatic',
'd3-array',
'd3-color',
'd3-format',
'd3-interpolate',
'd3-time',
'd3-time-format',
'internmap',
].join('|');
module.exports = async () => {
const config = await createJestConfig(customJestConfig)();
config.transformIgnorePatterns = [
`/node_modules/(?!(?:${d3EsmModules})/)`,
'^.+\\.module\\.(css|sass|scss)$',
];
return config;
};