-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
35 lines (31 loc) · 1.14 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
const { pathsToModuleNameMapper } = require('ts-jest/utils');
const { compilerOptions } = require('./tsconfig.json');
// this creates a module name map based on all the path aliases from tsconfig
// (so you only need to add path aliases in tsconfig, not here).
const moduleNameMapper = compilerOptions.paths
? pathsToModuleNameMapper(compilerOptions.paths, { prefix: '<rootDir>/../' })
: {};
const testPathIgnorePatterns = ['<rootDir>/node_modules', 'factories', 'helpers', 'tests/e2e'];
/** @type {import('jest').Config} */
module.exports = {
preset: 'ts-jest',
rootDir: 'tests',
// setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.ts'],
globalSetup: '<rootDir>/jest.setup.js',
globalTeardown: '<rootDir>/jest.teardown.js',
testPathIgnorePatterns,
globals: {
'ts-jest': {
tsconfig: {
jsx: 'react-jsx',
},
},
},
transformIgnorePatterns: ['/node_modules/(?!(@swc|@trpc))/'],
moduleNameMapper: {
...moduleNameMapper,
// Handle image imports
// https://jestjs.io/docs/webpack#handling-static-assets
'^.+\\.(png|jpg|jpeg|gif|webp|avif|ico|bmp|svg)$/i': `<rootDir>/__mocks__/fileMock.js`,
},
};