Skip to content

Commit

Permalink
test: run test agains react 16,17,18
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenOutman committed Aug 1, 2023
1 parent dd79844 commit a359a22
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 128 deletions.
17 changes: 14 additions & 3 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
- uses: actions/checkout@v3
- name: Use Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- run: npm ci
- 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 a359a22

Please sign in to comment.