forked from pln-planning-tools/Starmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
30 lines (27 loc) · 836 Bytes
/
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
const nextJest = require('next/jest');
const createJestConfig = nextJest({
dir: './',
})
const customJestConfig = {
testEnvironment: 'jest-environment-node',
collectCoverageFrom: ['lib', 'components', 'hooks', 'pages'].map(dir => `${dir}/**/*.{js,jsx,ts,tsx}`),
preset: 'ts-jest',
transform: {
// this is required because: https://github.com/vercel/next.js/discussions/19155
// next overwrites the default jest transform for ts/tsx files
// this is a workaround to use ts-jest for tests
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: {
jsx: 'react-jsx',
},
},
],
},
testPathIgnorePatterns: ['node_modules', '.next', 'e2e'],
moduleNameMapper: {
'^d3$': '<rootDir>/node_modules/d3/dist/d3.min.js',
},
};
module.exports = createJestConfig(customJestConfig)