Skip to content

Commit

Permalink
react 16 test
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Dec 1, 2020
1 parent 7b54be7 commit ce60851
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:

- name: install
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
run: npm ci
run: |
npm ci
./scripts/install-react.sh
compile:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -258,3 +260,30 @@ jobs:
env:
LIB_DIR: es
needs: compile

dom-react-16:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master

- name: restore cache from package-lock.json
uses: actions/cache@v2
with:
path: package-temp-dir
key: lock-${{ github.sha }}

- name: restore cache from node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}

- name: test
run: npm test -- -w 1 --coverage

- name: coverage
run: bash <(curl -s https://codecov.io/bash)
needs: setup
environment:
REACT: 16
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
"docsearch.js": "^2.6.3",
"enquire-js": "^0.2.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"enzyme-to-json": "^3.6.0",
"esbuild-webpack-plugin": "^1.0.0",
"eslint": "^7.9.0",
Expand Down
8 changes: 8 additions & 0 deletions scripts/install-react.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#!/bin/bash

set -x

if [ "$REACT" = 16 ]; then
npm i --no-save react@16 react-dom@16 react-test-renderer@16 enzyme-adapter-react-16
fi
5 changes: 4 additions & 1 deletion tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ if (typeof window !== 'undefined') {

const Enzyme = require('enzyme');

const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
const Adapter =
process.env.REACT === '16'
? require('enzyme-adapter-react-16') // eslint-disable-line import/no-extraneous-dependencies
: require('@wojtekmaj/enzyme-adapter-react-17');

Enzyme.configure({ adapter: new Adapter() });

Expand Down

0 comments on commit ce60851

Please sign in to comment.