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 }}
|
key: lock-${{ github.sha }}
|
||||||
|
|
||||||
- name: create package-lock.json
|
- 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
|
- name: hack for single file
|
||||||
run: |
|
run: |
|
||||||
@ -40,7 +40,7 @@ jobs:
|
|||||||
|
|
||||||
- name: install
|
- name: install
|
||||||
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
|
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
|
||||||
run: npm ci
|
run: npm ci --force
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -232,6 +232,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
react: ['16', '17']
|
react: ['16', '17']
|
||||||
|
# react: ['17', '18']
|
||||||
module: ['dom', 'node', 'dist']
|
module: ['dom', 'node', 'dist']
|
||||||
env:
|
env:
|
||||||
REACT: ${{ matrix.react }}
|
REACT: ${{ matrix.react }}
|
||||||
@ -256,6 +257,14 @@ jobs:
|
|||||||
if: ${{ matrix.react == '16' }}
|
if: ${{ matrix.react == '16' }}
|
||||||
run: npm run install-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
|
- name: restore cache from dist
|
||||||
if: ${{ matrix.module == 'dist' }}
|
if: ${{ matrix.module == 'dist' }}
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@ -341,36 +350,55 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
react: ['16', '17']
|
react: ['16', '17']
|
||||||
|
# react: ['17', '18']
|
||||||
module: [lib, es]
|
module: [lib, es]
|
||||||
env:
|
env:
|
||||||
REACT: ${{ matrix.react }}
|
REACT: ${{ matrix.react }}
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- 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
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: restore cache from package-lock.json
|
- 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
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: package-temp-dir
|
path: package-temp-dir
|
||||||
key: lock-${{ github.sha }}
|
key: lock-${{ github.sha }}
|
||||||
|
|
||||||
- name: restore cache from node_modules
|
- 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
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
|
||||||
|
|
||||||
- name: restore cache from ${{ matrix.module }}
|
- 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
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ matrix.module }}
|
path: ${{ matrix.module }}
|
||||||
key: ${{ matrix.module }}-${{ github.sha }}
|
key: ${{ matrix.module }}-${{ github.sha }}
|
||||||
|
|
||||||
- name: install react 16
|
- 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
|
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
|
- name: test
|
||||||
|
# lib only run in master branch not in pull request
|
||||||
|
if: ${{ github.event_name != 'pull_request' || matrix.module != 'lib' }}
|
||||||
run: npm test
|
run: npm test
|
||||||
env:
|
env:
|
||||||
LIB_DIR: ${{ matrix.module }}
|
LIB_DIR: ${{ matrix.module }}
|
||||||
|
@ -108,11 +108,6 @@ describe('Carousel', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should keep initialSlide', () => {
|
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} />);
|
const wrapper = mount(<Carousel initialSlide={1} />);
|
||||||
wrapper.setProps({
|
wrapper.setProps({
|
||||||
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
children: [<div key="1" />, <div key="2" />, <div key="3" />],
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { render, mount } from 'enzyme';
|
import { render, mount } from 'enzyme';
|
||||||
import { act } from 'react-test-renderer';
|
import { act } from 'react-dom/test-utils';
|
||||||
import Space from '..';
|
import Space from '..';
|
||||||
import ConfigProvider from '../../config-provider';
|
import ConfigProvider from '../../config-provider';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
|
@ -99,7 +99,9 @@
|
|||||||
"site:test": "jest --config .jest.site.js --cache=false --force-exit",
|
"site:test": "jest --config .jest.site.js --cache=false --force-exit",
|
||||||
"test-image": "npm run dist && docker-compose run tests",
|
"test-image": "npm run dist && docker-compose run tests",
|
||||||
"version": "node ./scripts/generate-version",
|
"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"
|
"argos": "argos upload imageSnapshots"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
@ -247,12 +249,12 @@
|
|||||||
"rc-footer": "^0.6.6",
|
"rc-footer": "^0.6.6",
|
||||||
"rc-tween-one": "^3.0.3",
|
"rc-tween-one": "^3.0.3",
|
||||||
"rc-virtual-list": "^3.4.2",
|
"rc-virtual-list": "^3.4.2",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.0",
|
||||||
"react-color": "^2.17.3",
|
"react-color": "^2.17.3",
|
||||||
"react-copy-to-clipboard": "^5.0.1",
|
"react-copy-to-clipboard": "^5.0.1",
|
||||||
"react-dnd": "^15.0.0",
|
"react-dnd": "^15.0.0",
|
||||||
"react-dnd-html5-backend": "^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-draggable": "^4.4.3",
|
||||||
"react-fast-marquee": "^1.2.1",
|
"react-fast-marquee": "^1.2.1",
|
||||||
"react-github-button": "^0.1.11",
|
"react-github-button": "^0.1.11",
|
||||||
@ -264,7 +266,6 @@
|
|||||||
"react-router-dom": "^6.0.2",
|
"react-router-dom": "^6.0.2",
|
||||||
"react-sortable-hoc": "^2.0.0",
|
"react-sortable-hoc": "^2.0.0",
|
||||||
"react-sticky": "^6.0.3",
|
"react-sticky": "^6.0.3",
|
||||||
"react-test-renderer": "^17.0.1",
|
|
||||||
"react-text-loop-next": "0.0.3",
|
"react-text-loop-next": "0.0.3",
|
||||||
"react-window": "^1.8.5",
|
"react-window": "^1.8.5",
|
||||||
"remark": "^14.0.1",
|
"remark": "^14.0.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user