forked from OpenQDev/OpenQ-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
executable file
·41 lines (33 loc) · 1.07 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
// jest.config.js
const nextJest = require('next/jest');
const createJestConfig = nextJest();
const customJestConfig = {
setupFilesAfterEnv: ['./jest.setup.js'],
bail: true,
reporters: ['default', 'jest-junit'],
moduleNameMapper: {
'^@components(.*)$': '<rootDir>/components$1',
'^@pages(.*)$': '<rootDir>/pages$1',
'^@hooks(.*)$': '<rootDir>/hooks$1',
'^d3$': '<rootDir>/node_modules/d3/dist/d3.min.js',
},
testEnvironment: 'jest-environment-jsdom',
};
// createJestConfig returns an async function that returns a jest config -
// so instead of doing this:
// module.exports = createJestConfig(customJestConfig)
// Take the returned async function...
const asyncConfig = createJestConfig(customJestConfig);
process.env = Object.assign(process.env, {
NEXT_PUBLIC_DEPLOY_ENV: 'local',
VAR_NAME_2: 'varValue2',
});
// and wrap it...
module.exports = async () => {
const config = await asyncConfig();
config.transformIgnorePatterns = [
// ...your ignore patterns
];
config.transformIgnorePatterns = ['node_modules/(?!axios)/'];
return config;
};