mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: React 18 test case (#34781)
* chore: add 18 test * chore: update test flow * chore: fail fast * chore: foce ci * chore: more if * chore: test it * chore: back of it * chore: master only * chore: fix spell * chore: force install * test: comment 16 tmp * chore: use react 17 * chore: install 18 * chore: back of 16 & 17
This commit is contained in:
parent
c89e33d0b6
commit
2733977245
34
.github/workflows/test.yml
vendored
34
.github/workflows/test.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
key: lock-${{ github.sha }}
|
||||
|
||||
- name: create package-lock.json
|
||||
run: npm i --package-lock-only --ignore-scripts
|
||||
run: npm i --package-lock-only --ignore-scripts --force
|
||||
|
||||
- name: hack for single file
|
||||
run: |
|
||||
@ -40,7 +40,7 @@ jobs:
|
||||
|
||||
- name: install
|
||||
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
run: npm ci --force
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
@ -232,6 +232,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
react: ['16', '17']
|
||||
# react: ['17', '18']
|
||||
module: ['dom', 'node', 'dist']
|
||||
env:
|
||||
REACT: ${{ matrix.react }}
|
||||
@ -256,6 +257,14 @@ jobs:
|
||||
if: ${{ matrix.react == '16' }}
|
||||
run: npm run install-react-16
|
||||
|
||||
- name: install react 17
|
||||
if: ${{ matrix.react == '17' }}
|
||||
run: npm run install-react-17
|
||||
|
||||
- name: install react 18
|
||||
if: ${{ matrix.react == '18' }}
|
||||
run: npm run install-react-18
|
||||
|
||||
- name: restore cache from dist
|
||||
if: ${{ matrix.module == 'dist' }}
|
||||
uses: actions/cache@v3
|
||||
@ -341,36 +350,55 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
react: ['16', '17']
|
||||
# react: ['17', '18']
|
||||
module: [lib, es]
|
||||
env:
|
||||
REACT: ${{ matrix.react }}
|
||||
steps:
|
||||
- name: checkout
|
||||
# lib only run in master branch not in pull request
|
||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: restore cache from package-lock.json
|
||||
# lib only run in master branch not in pull request
|
||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: package-temp-dir
|
||||
key: lock-${{ github.sha }}
|
||||
|
||||
- name: restore cache from node_modules
|
||||
# lib only run in master branch not in pull request
|
||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
||||
|
||||
- name: restore cache from ${{ matrix.module }}
|
||||
# lib only run in master branch not in pull request
|
||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ matrix.module }}
|
||||
key: ${{ matrix.module }}-${{ github.sha }}
|
||||
|
||||
- name: install react 16
|
||||
if: ${{ matrix.react == '16' }}
|
||||
if: ${{ matrix.react == '16' && (github.event_name != 'pull_request' || matrix.module != 'lib') }}
|
||||
run: npm run install-react-16
|
||||
|
||||
- name: install react 17
|
||||
if: ${{ matrix.react == '17' && (github.event_name != 'pull_request' || matrix.module != 'lib') }}
|
||||
run: npm run install-react-17
|
||||
|
||||
- name: install react 18
|
||||
if: ${{ matrix.react == '18' && (github.event_name != 'pull_request' || matrix.module != 'lib') }}
|
||||
run: npm run install-react-18
|
||||
|
||||
- name: test
|
||||
# lib only run in master branch not in pull request
|
||||
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||
run: npm test
|
||||
env:
|
||||
LIB_DIR: ${{ matrix.module }}
|
||||
|
@ -108,11 +108,6 @@ describe('Carousel', () => {
|
||||
});
|
||||
|
||||
it('should keep initialSlide', () => {
|
||||
// react unsafe lifecycle don't works in React 15
|
||||
// https://github.com/akiran/react-slick/commit/97988e897750e1d8f7b10a86b655f50d75d38298
|
||||
if (process.env.REACT === '15') {
|
||||
return;
|
||||
}
|
||||
const wrapper = mount(<Carousel initialSlide={1} />);
|
||||
wrapper.setProps({
|
||||
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { useState } from 'react';
|
||||
import { render, mount } from 'enzyme';
|
||||
import { act } from 'react-test-renderer';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import Space from '..';
|
||||
import ConfigProvider from '../../config-provider';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
|
@ -99,7 +99,9 @@
|
||||
"site:test": "jest --config .jest.site.js --cache=false --force-exit",
|
||||
"test-image": "npm run dist && docker-compose run tests",
|
||||
"version": "node ./scripts/generate-version",
|
||||
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16 react-test-renderer@16 enzyme-adapter-react-16",
|
||||
"install-react-16": "npm i --no-save --legacy-peer-deps react@16 react-dom@16 enzyme-adapter-react-16",
|
||||
"install-react-17": "npm i --no-save --legacy-peer-deps react@17 react-dom@17",
|
||||
"install-react-18": "npm i --no-save --legacy-peer-deps react@18 react-dom@18",
|
||||
"argos": "argos upload imageSnapshots"
|
||||
},
|
||||
"browserslist": [
|
||||
@ -247,12 +249,12 @@
|
||||
"rc-footer": "^0.6.6",
|
||||
"rc-tween-one": "^3.0.3",
|
||||
"rc-virtual-list": "^3.4.2",
|
||||
"react": "^17.0.1",
|
||||
"react": "^17.0.0",
|
||||
"react-color": "^2.17.3",
|
||||
"react-copy-to-clipboard": "^5.0.1",
|
||||
"react-dnd": "^15.0.0",
|
||||
"react-dnd-html5-backend": "^15.0.0",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-dom": "^17.0.0",
|
||||
"react-draggable": "^4.4.3",
|
||||
"react-fast-marquee": "^1.2.1",
|
||||
"react-github-button": "^0.1.11",
|
||||
@ -264,7 +266,6 @@
|
||||
"react-router-dom": "^6.0.2",
|
||||
"react-sortable-hoc": "^2.0.0",
|
||||
"react-sticky": "^6.0.3",
|
||||
"react-test-renderer": "^17.0.1",
|
||||
"react-text-loop-next": "0.0.3",
|
||||
"react-window": "^1.8.5",
|
||||
"remark": "^14.0.1",
|
||||
|
Loading…
Reference in New Issue
Block a user