-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
/
jest.config.js
41 lines (39 loc) · 1.11 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
const path = require('path');
const fs = require('fs');
const packages = fs.readdirSync(path.resolve(__dirname, './packages'));
const moduleNameMapper = packages.reduce((mapper, dirName) => {
const pkg = require(
path.resolve(__dirname, './packages', dirName, 'package.json')
);
mapper[`^${pkg.name}(.*)$`] = path.join(
__dirname,
`./packages/${dirName}/src$1`
);
return mapper;
}, {});
module.exports = {
globalSetup: './test-global-setup.js',
setupFilesAfterEnv: ['./test-setup.js'],
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
'/node_modules/',
'/lib/',
'/esm/',
'/examples/simple/',
'/packages/create-react-admin/templates',
],
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\](?!(@hookform)/).+\\.(js|jsx|mjs|ts|tsx)$',
],
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
'^.+\\.[tj]sx?$': [
'ts-jest',
{
isolatedModules: true,
useESM: true,
},
],
},
moduleNameMapper,
};