Skip to content

Commit 13c8626

Browse files
authored
Fix: Upgrade to react 18 (#159)
## Summary 1. Updates React SDK to use React 18 and fixed related typescript issues. 2. Replaces `enzyme` with `react testing library` to make unit tests work with React 18. ## Test Plan - Updated many unit tests to use React Testing Library instead of Enzyme. - E2E Tests also Pass.
1 parent 53bf11b commit 13c8626

File tree

9 files changed

+671
-892
lines changed

9 files changed

+671
-892
lines changed

.github/workflows/react.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3
16-
- name: Set up Node 10
16+
- name: Set up Node 16
1717
uses: actions/setup-node@v3
1818
with:
19-
node-version: 10
19+
node-version: 16
2020
- run: yarn install
2121
- run: yarn test
2222

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Bug fixes
1111
- addresses issues [#152](https://github.com/optimizely/react-sdk/issues/152) and [#134](https://github.com/optimizely/react-sdk/issues/134): Gracefully returns pessimistic default values when hooks fail instead of throwing an error.
1212
- fixed issue [#156](https://github.com/optimizely/react-sdk/issues/156) - Added children prop to make the SDK compatible with React 18([#158](https://github.com/optimizely/react-sdk/pull/158)).
13+
- Updates React SDK to use React 18 and fixed related typescript issues ([#159](https://github.com/optimizely/react-sdk/pull/159)).
14+
- Replaces `enzyme` with `react testing library` to make unit tests work with React 18 ([#159](https://github.com/optimizely/react-sdk/pull/159)).
1315

1416
## [2.8.1] - March 7, 2022
1517

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,24 @@
4242
"@rollup/plugin-commonjs": "^16.0.0",
4343
"@rollup/plugin-node-resolve": "^10.0.0",
4444
"@rollup/plugin-replace": "^2.3.4",
45-
"@types/enzyme": "^3.1.15",
46-
"@types/enzyme-adapter-react-16": "^1.0.3",
45+
"@testing-library/jest-dom": "^5.16.4",
46+
"@testing-library/react": "^13.1.1",
4747
"@types/hoist-non-react-statics": "^3.3.1",
4848
"@types/jest": "^26.0.14",
4949
"@types/prop-types": "^15.5.6",
50-
"@types/react": "^16.7.18",
51-
"@types/react-dom": "^16.9.5",
50+
"@types/react": "^18.0.6",
51+
"@types/react-dom": "^18.0.2",
5252
"@typescript-eslint/eslint-plugin": "^2.23.0",
5353
"@typescript-eslint/parser": "^2.23.0",
54-
"enzyme": "^3.8.0",
55-
"enzyme-adapter-react-16": "^1.7.1",
5654
"eslint": "^6.8.0",
5755
"eslint-config-prettier": "^6.10.0",
5856
"eslint-plugin-prettier": "^3.1.2",
5957
"eslint-plugin-react": "^7.19.0",
6058
"eslint-plugin-react-hooks": "^4.1.0",
6159
"jest": "^26.5.2",
6260
"prettier": "1.19.1",
63-
"react": "^16.8.0",
64-
"react-dom": "^16.8.0",
61+
"react": "^18.0.0",
62+
"react-dom": "^18.0.0",
6563
"rollup": "^2.32.1",
6664
"rollup-plugin-typescript2": "^0.28.0",
6765
"rollup-plugin-uglify": "^6.0.4",

0 commit comments

Comments
 (0)