Skip to content

Commit e584ec3

Browse files
committed
Update Jest config to match React 18 usage scenarios
1 parent 597f686 commit e584ec3

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

jest.config.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const tsTestFolderPath = (folderName) =>
1313

1414
const tsStandardConfig = {
1515
...defaults,
16-
displayName: 'ReactDOM',
16+
displayName: 'ReactDOM 18',
1717
preset: 'ts-jest',
1818
testMatch: NORMAL_TEST_FOLDERS.map(tsTestFolderPath),
1919
}
@@ -29,18 +29,30 @@ const rnConfig = {
2929
},
3030
}
3131

32-
const compatEntryConfig = {
32+
const standardReact17Config = {
3333
...tsStandardConfig,
34-
displayName: 'Compat',
34+
displayName: 'ReactDOM 17',
3535
moduleNameMapper: {
3636
'^react$': 'react-17',
3737
'^react-dom$': 'react-dom-17',
3838
'^react-test-renderer$': 'react-test-renderer-17',
3939
'^@testing-library/react$': '@testing-library/react-12',
40-
'../../src/index': '<rootDir>/src/compat',
40+
},
41+
}
42+
43+
const nextEntryConfig = {
44+
...tsStandardConfig,
45+
displayName: 'Next',
46+
moduleNameMapper: {
47+
'../../src/index': '<rootDir>/src/next',
4148
},
4249
}
4350

4451
module.exports = {
45-
projects: [tsStandardConfig, rnConfig, compatEntryConfig],
52+
projects: [
53+
tsStandardConfig,
54+
rnConfig,
55+
standardReact17Config,
56+
nextEntryConfig,
57+
],
4658
}

0 commit comments

Comments
 (0)