Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump react to v17.x #275

Merged
merged 15 commits into from
Mar 29, 2022
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]
react: [16, 17]

name: build (${{ matrix.node-version }} w/ React ${{ matrix.react }}

steps:
- uses: actions/[email protected]
Expand All @@ -25,5 +28,19 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Install React v${{ matrix.react }}
run: npm i react@${{ matrix.react }} react-dom@${{ matrix.react }}

- name: Install React 16 Enzyme adapter
if: matrix.react == '16'
run: |
npm remove @wojtekmaj/enzyme-adapter-react-17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this when we're doing React 16 because NPM might throw issues with it wanting React 17 to be around.

npm install enzyme-adapter-react-16

- name: Run tests
if: matrix.react == '16'
run: REACT_VERSION=16 npm test

- name: Run tests
if: matrix.react == '17'
run: npm test
10 changes: 9 additions & 1 deletion lib/enzyme.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/* eslint-disable import/no-extraneous-dependencies */
const Adapter = require('enzyme-adapter-react-16');
/* eslint-disable import/no-unresolved */
/* eslint-disable global-require */
const enzyme = require('enzyme');

let Adapter;
if (process.env.REACT_VERSION && process.env.REACT_VERSION === '16') {
Adapter = require('enzyme-adapter-react-16');
} else {
Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
}

require('core-js/stable');
require('regenerator-runtime/runtime');

Expand Down
Loading