Skip to content

Commit

Permalink
React 18 (u-wave#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop authored Apr 6, 2022
1 parent f483e54 commit 476be23
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,60 @@ name: CI
on: [push, pull_request]

jobs:
lint:
name: Code style
types:
name: Types
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: lts/*
- name: Install dependencies
run: npm install
- name: Check code style
run: npm run lint
- name: Check types
run: npm run tsd

types:
name: Test types
lint:
name: Code style
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: lts/*
- name: Install dependencies
run: npm install
- name: Check types
run: npm run test:types
- name: Check code style
run: npm run lint

test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]
react-version: ['16', '17']
node-version: [14.x, 16.x, 17.x]
react-version: [17.x, 18.x]
include:
- node-version: 12.x
react-version: 16.0.0
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Node.js ${{matrix.node-version}}
uses: actions/setup-node@v2
with:
node-version: ${{matrix.node-version}}
- name: Install dependencies
run: npm install
- name: Install React ${{matrix.react-version}}
if: matrix.react-version != '17'
run: npm install react@${{matrix.react-version}} react-dom@${{matrix.react-version}} react-test-renderer@${{matrix.react-version}}
if: matrix.react-version != '18.x'
run: |
npm install --save-dev \
react@${{matrix.react-version}} \
react-dom@${{matrix.react-version}}
- name: Run tests
run: npm run test:unit
run: npm run tests-only
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16.x'
node-version: lts/*
- name: Install
run: npm install
- name: Run tests
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@u-wave/react-vimeo": "file:..",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"esbuild": "^0.14.0",
Expand Down
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"prepare": "npm run build",
"build": "rollup -c",
"lint": "eslint --cache .",
"test": "npm run lint && npm run test:unit && npm run test:types",
"test:unit": "cross-env BABEL_ENV=test mocha --require @babel/register test/*.js",
"test:types": "tsd",
"test": "npm run lint && npm run tests-only && npm run tsd",
"tests-only": "cross-env BABEL_ENV=test mocha --require @babel/register test/*.js",
"tsd": "tsd",
"docs": "prop-types-table src/index.js | md-insert README.md --header Props -i",
"example": "npm run -w example build"
},
Expand Down Expand Up @@ -60,9 +60,8 @@
"mocha": "^9.1.3",
"prop-types-table": "^1.0.0",
"proxyquire": "^2.1.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-test-renderer": "^17.0.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"rollup": "^2.35.0",
"tsd": "^0.20.0"
},
Expand Down
16 changes: 0 additions & 16 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
import React from 'react';
import { createRenderer } from 'react-test-renderer/shallow';
import expect, { createSpy } from 'expect';
import render from './util/render';
import createVimeo from './util/createVimeo';

describe('Vimeo', () => {
it('should render a div with an ID and className', () => {
const { Vimeo } = createVimeo();
const renderer = createRenderer();
renderer.render(<Vimeo id="myId" className="myClassName" />);
expect(renderer.getRenderOutput()).toMatch({
type: 'div',
props: {
id: 'myId',
className: 'myClassName',
},
});
});

it('should create a Vimeo player when mounted', async () => {
const onReady = createSpy();
const { sdkMock, playerMock } = render({
Expand Down

0 comments on commit 476be23

Please sign in to comment.