-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.js
31 lines (28 loc) · 1.03 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
/* eslint-disable @typescript-eslint/no-var-requires */
const { pathsToModuleNameMapper } = require('ts-jest');
const nextJest = require('next/jest');
const { compilerOptions } = require('./tsconfig.json');
const createJestConfig = nextJest({
dir: './',
});
// Add any custom config to be passed to Jest
const customJestConfig = {
moduleNameMapper: {
'.+\\.svg\\?url$': 'jest-transform-stub',
'^@/(.+)$': '<rootDir>/$1',
...pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>/',
}),
'\\.svg$': '<rootDir>/__mocks__/svg.js',
"^.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
snapshotSerializers: ['@emotion/jest/serializer'],
testEnvironment: 'jest-environment-jsdom',
testPathIgnorePatterns: ['/node_modules/', '/e2e/'],
transform: {
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.tsx?$': 'ts-jest',
},
};
module.exports = createJestConfig(customJestConfig);