-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
28 lines (26 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
/* eslint-disable @typescript-eslint/no-var-requires */
const { pathsToModuleNameMapper } = require('ts-jest');
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
// which contains the path mapping (ie the `compilerOptions.paths` option):
const { compilerOptions } = require('./tsconfig.json');
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
modulePaths: [compilerOptions.baseUrl],
moduleNameMapper: {
'\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/mocks/fileMock.js',
'\\.(css|less)$': '<rootDir>/src/mocks/fileMock.js',
...pathsToModuleNameMapper(compilerOptions.paths),
},
setupFilesAfterEnv: ['./src/setupTest.ts', './jsdom-extended.js'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testEnvironment: './jsdom-extended.js',
transform: {
'^.+\\.jsx?$': require.resolve('babel-jest'),
'^.+\\.tsx?$': 'ts-jest',
},
testEnvironmentOptions: {
customExportConditions: [''],
},
};