Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

jest.config.ts

26 lines842 Bytes

1const reactVersion = (process.env.REACTJS_VERSION || '19') as '17' | '18' | '19'
2const reactModulesByVersion = {
3 '17': {
4 '^react((\\/.*)?)$': 'react-17$1',
5 '^react-dom/client((\\/.*)?)$': 'react-dom-17$1',
6 '^react-dom((\\/.*)?)$': 'react-dom-17$1',
7 '^@testing-library/react': '@testing-library/react-17',
8 },
9 '18': {
10 '^react((\\/.*)?)$': 'react-18$1',
11 '^react-dom((\\/.*)?)$': 'react-dom-18$1',
12 '^@testing-library/react': '@testing-library/react-18',
13 },
14 '19': {
15 '^react((\\/.*)?)$': 'react$1',
16 '^react-dom((\\/.*)?)$': 'react-dom$1',
17 '^@testing-library/react': '@testing-library/react',
18 },
19}[reactVersion]
20​
21export default {
22 displayName: 'react-query-persist-client',
23 preset: '../../jest-preset.js',
24 moduleNameMapper: reactModulesByVersion,
25 setupFilesAfterEnv: ['./jest.setup.ts'],