Skip to content

Commit f36ab6e

Browse files
authored
Merge branch 'master' into pr/include-svg-element-types
2 parents dfdc067 + 456424f commit f36ab6e

File tree

7 files changed

+127
-64
lines changed

7 files changed

+127
-64
lines changed

.github/workflows/validate.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: validate
2+
on:
3+
push:
4+
branches:
5+
- '+([0-9])?(.{+([0-9]),x}).x'
6+
- 'master'
7+
- 'next'
8+
- 'next-major'
9+
- 'beta'
10+
- 'alpha'
11+
- '!all-contributors/**'
12+
pull_request: {}
13+
jobs:
14+
main:
15+
continue-on-error: ${{ matrix.react != 'latest' }}
16+
# ignore all-contributors PRs
17+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
18+
strategy:
19+
matrix:
20+
node: [10.13, 12, 14, 15]
21+
react: [latest, next, experimental]
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: ⬇️ Checkout repo
25+
uses: actions/checkout@v2
26+
27+
- name: ⎔ Setup node
28+
uses: actions/setup-node@v1
29+
with:
30+
node-version: ${{ matrix.node }}
31+
32+
- name: 📥 Download deps
33+
uses: bahmutov/npm-install@v1
34+
with:
35+
useLockFile: false
36+
37+
# as requested by the React team :)
38+
# https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing
39+
- name: ⚛️ Setup react
40+
run: npm install react@${{ matrix.react }} react-dom@${{ matrix.react }}
41+
42+
- name: ▶️ Run validate script
43+
run: npm run validate
44+
45+
- name: ⬆️ Upload coverage report
46+
uses: codecov/codecov-action@v1
47+
48+
release:
49+
needs: main
50+
runs-on: ubuntu-latest
51+
if:
52+
${{ github.repository == 'testing-library/react-testing-library' &&
53+
contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha',
54+
github.ref) && github.event_name == 'push' }}
55+
steps:
56+
- name: ⬇️ Checkout repo
57+
uses: actions/checkout@v2
58+
59+
- name: ⎔ Setup node
60+
uses: actions/setup-node@v1
61+
with:
62+
node-version: 14
63+
64+
- name: 📥 Download deps
65+
uses: bahmutov/npm-install@v1
66+
with:
67+
useLockFile: false
68+
69+
- name: 🏗 Run build script
70+
run: npm run build
71+
72+
- name: 🚀 Release
73+
uses: cycjimmy/semantic-release-action@v2
74+
with:
75+
semantic_version: 17
76+
branches: |
77+
[
78+
'+([0-9])?(.{+([0-9]),x}).x',
79+
'master',
80+
'next',
81+
'next-major',
82+
{name: 'beta', prerelease: true},
83+
{name: 'alpha', prerelease: true}
84+
]
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.travis.yml

-38
This file was deleted.

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ practices.</p>
2626
<!-- prettier-ignore-start -->
2727
[![Build Status][build-badge]][build]
2828
[![Code Coverage][coverage-badge]][coverage]
29-
[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends]
29+
[![version][version-badge]][package]
30+
[![downloads][downloads-badge]][npmtrends]
3031
[![MIT License][license-badge]][license]
31-
32-
[![All Contributors](https://img.shields.io/badge/all_contributors-102-orange.svg?style=flat-square)](#contributors)
33-
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]
32+
[![All Contributors][all-contributors-badge]](#contributors)
33+
[![PRs Welcome][prs-badge]][prs]
34+
[![Code of Conduct][coc-badge]][coc]
3435
[![Discord][discord-badge]][discord]
3536

3637
[![Watch on GitHub][github-watch-badge]][github-watch]
@@ -608,6 +609,7 @@ Thanks goes to these people ([emoji key][emojis]):
608609
609610
<!-- markdownlint-enable -->
610611
<!-- prettier-ignore-end -->
612+
611613
<!-- ALL-CONTRIBUTORS-LIST:END -->
612614
613615
This project follows the [all-contributors][all-contributors] specification.
@@ -622,8 +624,8 @@ Contributions of any kind welcome!
622624
[npm]: https://www.npmjs.com/
623625
[yarn]: https://classic.yarnpkg.com
624626
[node]: https://nodejs.org
625-
[build-badge]: https://img.shields.io/travis/testing-library/react-testing-library.svg?style=flat-square
626-
[build]: https://travis-ci.org/testing-library/react-testing-library
627+
[build-badge]: https://img.shields.io/github/workflow/status/testing-library/react-testing-library/validate?logo=github&style=flat-square
628+
[build]: https://github.com/testing-library/react-testing-library/actions?query=workflow%3Avalidate
627629
[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/react-testing-library.svg?style=flat-square
628630
[coverage]: https://codecov.io/github/testing-library/react-testing-library
629631
[version-badge]: https://img.shields.io/npm/v/@testing-library/react.svg?style=flat-square
@@ -644,6 +646,7 @@ Contributions of any kind welcome!
644646
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/react-testing-library.svg?style=social
645647
[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
646648
[all-contributors]: https://github.com/all-contributors/all-contributors
649+
[all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/react-testing-library?color=orange&style=flat-square
647650
[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106
648651
[bugs]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc
649652
[requests]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen

other/MAINTAINING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ any more of you than that.
3232
As a maintainer, you're fine to make your branches on the main repo or on your
3333
own fork. Either way is fine.
3434

35-
When we receive a pull request, a travis build is kicked off automatically (see
36-
the `.travis.yml` for what runs in the travis build). We avoid merging anything
37-
that breaks the travis build.
35+
When we receive a pull request, a github action is kicked off automatically (see
36+
the `.github/workflows/validate.yml` for what runs in the action). We avoid
37+
merging anything that breaks the validate action.
3838

3939
Please review PRs and focus on the code rather than the individual. You never
4040
know when this is someone's first ever PR and we want their experience to be as
@@ -49,7 +49,7 @@ to release. See the next section on Releases for more about that.
4949
## Release
5050

5151
Our releases are automatic. They happen whenever code lands into `master`. A
52-
travis build gets kicked off and if it's successful, a tool called
52+
github action gets kicked off and if it's successful, a tool called
5353
[`semantic-release`](https://github.com/semantic-release/semantic-release) is
5454
used to automatically publish a new release to npm as well as a changelog to
5555
GitHub. It is only able to determine the version and whether a release is

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@
4343
"author": "Kent C. Dodds <[email protected]> (https://kentcdodds.com)",
4444
"license": "MIT",
4545
"dependencies": {
46-
"@babel/runtime": "^7.12.1",
47-
"@testing-library/dom": "^7.26.6"
46+
"@babel/runtime": "^7.12.5",
47+
"@testing-library/dom": "^7.27.1"
4848
},
4949
"devDependencies": {
50-
"@testing-library/jest-dom": "^5.11.5",
51-
"@types/react-dom": "^16.9.8",
50+
"@testing-library/jest-dom": "^5.11.6",
51+
"@types/react-dom": "^16.9.9",
5252
"dotenv-cli": "^4.0.0",
53-
"dtslint": "4.0.4",
54-
"kcd-scripts": "^6.6.0",
53+
"dtslint": "4.0.5",
54+
"kcd-scripts": "^7.0.3",
5555
"npm-run-all": "^4.1.5",
56-
"react": "^16.13.1",
57-
"react-dom": "^16.13.1",
56+
"react": "^17.0.1",
57+
"react-dom": "^17.0.1",
5858
"rimraf": "^3.0.2",
5959
"typescript": "^4.0.5"
6060
},

types/test.tsx

+18-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react'
22
import {render, fireEvent, screen, waitFor} from '@testing-library/react'
33
import * as pure from '@testing-library/react/pure'
44

5-
async function testRender() {
5+
export async function testRender() {
66
const page = render(<div />)
77

88
// single queries
@@ -17,9 +17,10 @@ async function testRender() {
1717

1818
// helpers
1919
const {container, rerender, debug} = page
20+
return {container, rerender, debug}
2021
}
2122

22-
async function testPureRender() {
23+
export async function testPureRender() {
2324
const page = pure.render(<div />)
2425

2526
// single queries
@@ -34,20 +35,21 @@ async function testPureRender() {
3435

3536
// helpers
3637
const {container, rerender, debug} = page
38+
return {container, rerender, debug}
3739
}
3840

39-
async function testRenderOptions() {
41+
export function testRenderOptions() {
4042
const container = document.createElement('div')
4143
const options = {container}
4244
render(<div />, options)
4345
}
4446

45-
async function testFireEvent() {
47+
export function testFireEvent() {
4648
const {container} = render(<button />)
4749
fireEvent.click(container)
4850
}
4951

50-
async function testDebug() {
52+
export function testDebug() {
5153
const {debug, getAllByTestId} = render(
5254
<>
5355
<h2 data-testid="testid">Hello World</h2>
@@ -57,14 +59,22 @@ async function testDebug() {
5759
debug(getAllByTestId('testid'))
5860
}
5961

60-
async function testScreen() {
62+
export async function testScreen() {
6163
render(<button />)
6264

63-
screen.findByRole('button')
65+
await screen.findByRole('button')
6466
}
6567

66-
async function testWaitFor() {
68+
export async function testWaitFor() {
6769
const {container} = render(<button />)
6870
fireEvent.click(container)
6971
await waitFor(() => {})
7072
}
73+
74+
/*
75+
eslint
76+
testing-library/prefer-explicit-assert: "off",
77+
testing-library/no-wait-for-empty-callback: "off",
78+
testing-library/no-debug: "off",
79+
testing-library/prefer-screen-queries: "off"
80+
*/

types/tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"strictFunctionTypes": true,
1212
"noEmit": true,
1313
"baseUrl": ".",
14+
"skipLibCheck": true,
1415
"paths": {
1516
"@testing-library/react": ["."],
1617
"@testing-library/react/pure": ["."]

0 commit comments

Comments
 (0)