Skip to content

Commit

Permalink
Merge pull request #91 from rsuite/test/react-versions
Browse files Browse the repository at this point in the history
test: run test agains react 16,17,18
  • Loading branch information
SevenOutman authored Aug 1, 2023
2 parents dd79844 + bbd781c commit f018daa
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 130 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-rules-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rsuite/charts': patch
---

Add React 18 to compatible peerDepedencies
19 changes: 15 additions & 4 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@ on:
jobs:
test:
runs-on: ubuntu-latest
container: node:latest
strategy:
matrix:
react-version: [16, 17, 18]
steps:
- uses: actions/checkout@v2
- run: npm ci
- uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm ci --force
- run: npm run build
- run: npm test -- --coverage
- uses: codecov/codecov-action@v1
env:
REACT: ${{ matrix.react-version }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
flags: React ${{ matrix.react-version }}
16 changes: 16 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@ module.exports = {
'\\.svg': '<rootDir>/__mocks__/svg.js',
},
};

if (process.env.REACT === '17') {
module.exports.moduleNameMapper = {
...module.exports.moduleNameMapper,
'^react((\\/.*)?)$': 'react-17$1',
'^react-dom((\\/.*)?)$': 'react-dom-17$1',
};
}

if (process.env.REACT === '18') {
module.exports.moduleNameMapper = {
...module.exports.moduleNameMapper,
'^react((\\/.*)?)$': 'react-18$1',
'^react-dom((\\/.*)?)$': 'react-dom-18$1',
};
}
Loading

0 comments on commit f018daa

Please sign in to comment.