From 332a6d5972733975980d5e0b3e9583927aadf4d1 Mon Sep 17 00:00:00 2001 From: Lidor Avitan <35113398+lidoravitan@users.noreply.github.com> Date: Mon, 26 Oct 2020 20:59:24 +0200 Subject: [PATCH 01/24] docs: update complex example (#806) Co-authored-by: Lidor Avitan --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6bccc9ac..529d5c17 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,9 @@ function Login() { password: passwordInput.value, }), }) - .then(r => r.json()) + .then((r) => + r.json().then((data) => (r.ok ? data : Promise.reject(data))) + ) .then( user => { setState({loading: false, resolved: true, error: null}) @@ -282,9 +284,10 @@ import {setupServer} from 'msw/node' import {render, fireEvent, screen} from '@testing-library/react' import Login from '../login' +const fakeUserResponse = { token: 'fake_user_token' } const server = setupServer( rest.post('/api/login', (req, res, ctx) => { - return res(ctx.json({token: 'fake_user_token'})) + return res(ctx.json(fakeUserResponse)) }), ) @@ -322,7 +325,7 @@ test('allows the user to login successfully', async () => { test('handles server exceptions', async () => { // mock the server error response for this test suite only. server.use( - rest.post('/', (req, res, ctx) => { + rest.post('/api/login', (req, res, ctx) => { return res(ctx.status(500), ctx.json({message: 'Internal server error'})) }), ) From 50f54b59c621b93463abfe743b2aa68218ad3f63 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2020 13:00:20 -0600 Subject: [PATCH 02/24] docs: add lidoravitan as a contributor (#807) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 58552c8c..0fd4f4ab 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1194,6 +1194,15 @@ "contributions": [ "code" ] + }, + { + "login": "lidoravitan", + "name": "Lidor Avitan", + "avatar_url": "https://avatars0.githubusercontent.com/u/35113398?v=4", + "profile": "https://github.com/lidoravitan", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 529d5c17..ba9848ea 100644 --- a/README.md +++ b/README.md @@ -601,6 +601,7 @@ Thanks goes to these people ([emoji key][emojis]):
Gerrit Alex

πŸ’»
Karthick Raja

πŸ’»
Abdelrahman Ashraf

πŸ’» +
Lidor Avitan

πŸ“– From c2806fcc88d488663e0202a45e9c5ff528fb39fc Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 29 Oct 2020 15:06:17 +0100 Subject: [PATCH 03/24] test: Fix node 15 (#809) --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eae48ee7..fbe104b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,15 @@ node_js: - 10.14.2 - 12 - 14 - - node + - 15 env: - REACT_DIST=latest - REACT_DIST=next - REACT_DIST=experimental install: + # 7.0.6 fixed CI environments prompting user input. + # Can be removed once node15 bumps the shipped npm version. + - npm install --global npm@>=7.0.6 - npm install # as requested by the React team :) # https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing From 0db811283819fdc9774e36155ff806f44500533c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Thu, 29 Oct 2020 22:08:52 +0100 Subject: [PATCH 04/24] chore: update React imports (#811) --- README.md | 22 ++++++++++------------ src/__tests__/act.js | 2 +- src/__tests__/auto-cleanup-skip.js | 2 +- src/__tests__/auto-cleanup.js | 2 +- src/__tests__/cleanup.js | 2 +- src/__tests__/debug.js | 2 +- src/__tests__/end-to-end.js | 2 +- src/__tests__/events.js | 2 +- src/__tests__/multi-base.js | 2 +- src/__tests__/render.js | 2 +- src/__tests__/rerender.js | 2 +- src/__tests__/stopwatch.js | 2 +- src/act-compat.js | 2 +- src/pure.js | 2 +- 14 files changed, 23 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index ba9848ea..a43cb5a6 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ afterAll(() => { ```jsx // hidden-message.js -import React from 'react' +import * as React from 'react' // NOTE: React Testing Library works well with React Hooks and classes. // Your tests will be the same regardless of how you write your components. @@ -184,7 +184,7 @@ export default HiddenMessage import '@testing-library/jest-dom' // NOTE: jest-dom adds handy assertions to Jest and is recommended, but not required -import React from 'react' +import * as React from 'react' import {render, fireEvent, screen} from '@testing-library/react' import HiddenMessage from '../hidden-message' @@ -209,7 +209,7 @@ test('shows the children when the checkbox is checked', () => { ```jsx // login.js -import React from 'react' +import * as React from 'react' function Login() { const [state, setState] = React.useReducer((s, a) => ({...s, ...a}), { @@ -233,9 +233,7 @@ function Login() { password: passwordInput.value, }), }) - .then((r) => - r.json().then((data) => (r.ok ? data : Promise.reject(data))) - ) + .then(r => r.json().then(data => (r.ok ? data : Promise.reject(data)))) .then( user => { setState({loading: false, resolved: true, error: null}) @@ -276,7 +274,7 @@ export default Login // again, these first two imports are something you'd normally handle in // your testing framework configuration rather than importing them in every file. import '@testing-library/jest-dom' -import React from 'react' +import * as React from 'react' // import API mocking utilities from Mock Service Worker. import {rest} from 'msw' import {setupServer} from 'msw/node' @@ -284,7 +282,7 @@ import {setupServer} from 'msw/node' import {render, fireEvent, screen} from '@testing-library/react' import Login from '../login' -const fakeUserResponse = { token: 'fake_user_token' } +const fakeUserResponse = {token: 'fake_user_token'} const server = setupServer( rest.post('/api/login', (req, res, ctx) => { return res(ctx.json(fakeUserResponse)) @@ -400,8 +398,8 @@ principles: `react-dom`. 3. Utility implementations and APIs should be simple and flexible. -Most importantly, we want React Testing Library to be pretty -light-weight, simple, and easy to understand. +Most importantly, we want React Testing Library to be pretty light-weight, +simple, and easy to understand. ## Docs @@ -410,8 +408,7 @@ light-weight, simple, and easy to understand. ## Issues -Looking to contribute? Look for the [Good First Issue][good-first-issue] -label. +Looking to contribute? Look for the [Good First Issue][good-first-issue] label. ### πŸ› Bugs @@ -607,6 +604,7 @@ Thanks goes to these people ([emoji key][emojis]): + This project follows the [all-contributors][all-contributors] specification. diff --git a/src/__tests__/act.js b/src/__tests__/act.js index 97438d77..b60aac37 100644 --- a/src/__tests__/act.js +++ b/src/__tests__/act.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, fireEvent, screen} from '../' test('render calls useEffect immediately', () => { diff --git a/src/__tests__/auto-cleanup-skip.js b/src/__tests__/auto-cleanup-skip.js index e5ef35ae..5696d4e3 100644 --- a/src/__tests__/auto-cleanup-skip.js +++ b/src/__tests__/auto-cleanup-skip.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' let render beforeAll(() => { diff --git a/src/__tests__/auto-cleanup.js b/src/__tests__/auto-cleanup.js index 27debe45..450a6136 100644 --- a/src/__tests__/auto-cleanup.js +++ b/src/__tests__/auto-cleanup.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render} from '../' // This just verifies that by importing RTL in an diff --git a/src/__tests__/cleanup.js b/src/__tests__/cleanup.js index 4b67814a..6043ae06 100644 --- a/src/__tests__/cleanup.js +++ b/src/__tests__/cleanup.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, cleanup} from '../' test('cleans up the document', () => { diff --git a/src/__tests__/debug.js b/src/__tests__/debug.js index 14c0779a..e4e9faa0 100644 --- a/src/__tests__/debug.js +++ b/src/__tests__/debug.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, screen} from '../' beforeEach(() => { diff --git a/src/__tests__/end-to-end.js b/src/__tests__/end-to-end.js index cbbf0973..87c70f1b 100644 --- a/src/__tests__/end-to-end.js +++ b/src/__tests__/end-to-end.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, waitForElementToBeRemoved, screen} from '../' const fetchAMessage = () => diff --git a/src/__tests__/events.js b/src/__tests__/events.js index 0e28848f..8a6899af 100644 --- a/src/__tests__/events.js +++ b/src/__tests__/events.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, fireEvent} from '../' const eventTypes = [ diff --git a/src/__tests__/multi-base.js b/src/__tests__/multi-base.js index 06ad0902..ef5a7e11 100644 --- a/src/__tests__/multi-base.js +++ b/src/__tests__/multi-base.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render} from '../' // these are created once per test suite and reused for each case diff --git a/src/__tests__/render.js b/src/__tests__/render.js index 4e78afa6..fdc1ff4c 100644 --- a/src/__tests__/render.js +++ b/src/__tests__/render.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import ReactDOM from 'react-dom' import {render, screen} from '../' diff --git a/src/__tests__/rerender.js b/src/__tests__/rerender.js index 7cb9156d..f8ea377e 100644 --- a/src/__tests__/rerender.js +++ b/src/__tests__/rerender.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render} from '../' test('rerender will re-render the element', () => { diff --git a/src/__tests__/stopwatch.js b/src/__tests__/stopwatch.js index 3fe423b1..eeaf395c 100644 --- a/src/__tests__/stopwatch.js +++ b/src/__tests__/stopwatch.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import {render, fireEvent, screen} from '../' class StopWatch extends React.Component { diff --git a/src/act-compat.js b/src/act-compat.js index e999ecfe..40ecdab9 100644 --- a/src/act-compat.js +++ b/src/act-compat.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import ReactDOM from 'react-dom' import * as testUtils from 'react-dom/test-utils' diff --git a/src/pure.js b/src/pure.js index 8a062038..75098f78 100644 --- a/src/pure.js +++ b/src/pure.js @@ -1,4 +1,4 @@ -import React from 'react' +import * as React from 'react' import ReactDOM from 'react-dom' import { getQueriesForElement, From 1fc17466722be4dcc3224b2997b9c1f3bda4f740 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Fri, 30 Oct 2020 09:17:11 -0600 Subject: [PATCH 05/24] chore: adjust .travis to install latest npm (#812) As recommended by @ljharb https://github.com/testing-library/react-testing-library/pull/809/files#r514441103 --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbe104b8..026c7f4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,9 @@ env: - REACT_DIST=latest - REACT_DIST=next - REACT_DIST=experimental +before_install: + - nvm install-latest-npm install: - # 7.0.6 fixed CI environments prompting user input. - # Can be removed once node15 bumps the shipped npm version. - - npm install --global npm@>=7.0.6 - npm install # as requested by the React team :) # https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing From 48d2e73d8e7c77d03c63ec0876faa4196fdcfde9 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2020 09:18:54 -0600 Subject: [PATCH 06/24] docs: add ljharb as a contributor (#813) * docs: update README.md * docs: update .all-contributorsrc * docs: update README.md * docs: update .all-contributorsrc Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 10 ++++++++++ README.md | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0fd4f4ab..bf9b7cac 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1203,6 +1203,16 @@ "contributions": [ "doc" ] + }, + { + "login": "ljharb", + "name": "Jordan Harband", + "avatar_url": "https://avatars1.githubusercontent.com/u/45469?v=4", + "profile": "https://github.com/ljharb", + "contributions": [ + "review", + "ideas" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index a43cb5a6..32eba9dc 100644 --- a/README.md +++ b/README.md @@ -599,12 +599,12 @@ Thanks goes to these people ([emoji key][emojis]):
Karthick Raja

πŸ’»
Abdelrahman Ashraf

πŸ’»
Lidor Avitan

πŸ“– +
Jordan Harband

πŸ‘€ πŸ€” - This project follows the [all-contributors][all-contributors] specification. From e07e6416f25fd75df510c5d4211dc06f9f7398d7 Mon Sep 17 00:00:00 2001 From: Weyert de Boer Date: Tue, 3 Nov 2020 14:25:18 +0000 Subject: [PATCH 07/24] fix: upgrade dependencies, typescript, @testing-library/dom etc (#816) Co-authored-by: Weyert de Boer --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 9b314d91..e4b15e4a 100644 --- a/package.json +++ b/package.json @@ -43,20 +43,20 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.11.2", - "@testing-library/dom": "^7.26.0" + "@babel/runtime": "^7.12.1", + "@testing-library/dom": "^7.26.4" }, "devDependencies": { - "@testing-library/jest-dom": "^5.11.4", + "@testing-library/jest-dom": "^5.11.5", "@types/react-dom": "^16.9.8", - "dotenv-cli": "^3.2.0", - "dtslint": "4.0.0", - "kcd-scripts": "^6.3.0", + "dotenv-cli": "^4.0.0", + "dtslint": "4.0.4", + "kcd-scripts": "^6.6.0", "npm-run-all": "^4.1.5", "react": "^16.13.1", "react-dom": "^16.13.1", "rimraf": "^3.0.2", - "typescript": "^4.0.2" + "typescript": "^4.0.5" }, "peerDependencies": { "react": "*", From 2712dc2da46bc8af456b4759d5e4b2c971c54092 Mon Sep 17 00:00:00 2001 From: Marco Moretti Date: Tue, 10 Nov 2020 20:04:53 +0100 Subject: [PATCH 08/24] fix: import pretty-format from @testing-library/dom (#821) --- package.json | 2 +- types/index.d.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e4b15e4a..96c7df0f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "license": "MIT", "dependencies": { "@babel/runtime": "^7.12.1", - "@testing-library/dom": "^7.26.4" + "@testing-library/dom": "^7.26.6" }, "devDependencies": { "@testing-library/jest-dom": "^5.11.5", diff --git a/types/index.d.ts b/types/index.d.ts index 50702ecc..953f05d6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,7 +1,11 @@ // TypeScript Version: 3.8 -import {OptionsReceived as PrettyFormatOptions} from 'pretty-format' -import {queries, Queries, BoundFunction} from '@testing-library/dom' +import { + queries, + Queries, + BoundFunction, + prettyFormat, +} from '@testing-library/dom' import {act as reactAct} from 'react-dom/test-utils' export * from '@testing-library/dom' @@ -15,7 +19,7 @@ export type RenderResult = { | DocumentFragment | Array, maxLength?: number, - options?: PrettyFormatOptions, + options?: prettyFormat.OptionsReceived, ) => void rerender: (ui: React.ReactElement) => void unmount: () => boolean From 007b0b72d60fe018c950de1c07cb9889d7682f68 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Tue, 10 Nov 2020 12:09:13 -0700 Subject: [PATCH 09/24] docs: add marcosvega91 as a contributor (#822) Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com> --- .all-contributorsrc | 9 +++++++++ README.md | 3 +++ 2 files changed, 12 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index bf9b7cac..8c514263 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1213,6 +1213,15 @@ "review", "ideas" ] + }, + { + "login": "marcosvega91", + "name": "Marco Moretti", + "avatar_url": "https://avatars2.githubusercontent.com/u/5365582?v=4", + "profile": "https://github.com/marcosvega91", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/README.md b/README.md index 32eba9dc..c7033e52 100644 --- a/README.md +++ b/README.md @@ -601,6 +601,9 @@ Thanks goes to these people ([emoji key][emojis]):
Lidor Avitan

πŸ“–
Jordan Harband

πŸ‘€ πŸ€” + +
Marco Moretti

πŸ’» + From 3af1b4ba12dfc3a5c8f4968c1b92dba53823f9af Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sat, 14 Nov 2020 11:19:21 -0500 Subject: [PATCH 10/24] chore: switch to github actions (#826) Co-authored-by: Kent C. Dodds --- .github/workflows/validate.yml | 88 ++++++++++++++++++++++++++++++++++ .travis.yml | 38 --------------- README.md | 15 +++--- other/MAINTAINING.md | 8 ++-- package.json | 15 +++--- types/test.tsx | 26 ++++++---- 6 files changed, 127 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/validate.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..dcb53ad2 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,88 @@ +name: validate +on: + push: + branches: + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'next', + 'next-major', + 'beta', + 'alpha', + '!all-contributors/**', + ] + pull_request: + branches-ignore: ['all-contributors/**'] +jobs: + main: + continue-on-error: ${{ matrix.react != 'latest' }} + strategy: + matrix: + node: [10.13, 12, 14, 15] + react: [latest, next, experimental] + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: βŽ” Setup node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + + - name: πŸ“₯ Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + # as requested by the React team :) + # https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing + - name: βš›οΈ Setup react + run: npm install react@${{matrix.react}} react-dom@${{matrix.react}} + + - name: ▢️ Run validate script + run: npm run validate + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v1 + + release: + needs: main + runs-on: ubuntu-latest + if: + ${{ github.repository == 'testing-library/react-testing-library' && + contains('refs/heads/master,refs/heads/beta,refs/heads/next,refs/heads/alpha', + github.ref) && github.event_name == 'push' }} + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: βŽ” Setup node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: πŸ“₯ Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: πŸ— Run build script + run: npm run build + + - name: πŸš€ Release + uses: cycjimmy/semantic-release-action@v2 + with: + semantic_version: 17 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 026c7f4b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: node_js -cache: npm -notifications: - email: false -node_js: - # technically we support 10.0.0, but some of our tooling doesn't - - 10.14.2 - - 12 - - 14 - - 15 -env: - - REACT_DIST=latest - - REACT_DIST=next - - REACT_DIST=experimental -before_install: - - nvm install-latest-npm -install: - - npm install - # as requested by the React team :) - # https://reactjs.org/blog/2019/10/22/react-release-channels.html#using-the-next-channel-for-integration-testing - - npm install react@$REACT_DIST react-dom@$REACT_DIST -script: - - npm run validate - - npx codecov@3 -branches: - only: - - master - - beta - -jobs: - allow_failures: - - REACT_DIST=next - - REACT_DIST=experimental - include: - - stage: release - node_js: 14 - script: kcd-scripts travis-release - if: fork = false diff --git a/README.md b/README.md index c7033e52..73e421bb 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,12 @@ practices.

[![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] -[![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] +[![version][version-badge]][package] +[![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] - -[![All Contributors](https://img.shields.io/badge/all_contributors-102-orange.svg?style=flat-square)](#contributors) -[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] +[![All Contributors][all-contributors-badge]](#contributors) +[![PRs Welcome][prs-badge]][prs] +[![Code of Conduct][coc-badge]][coc] [![Discord][discord-badge]][discord] [![Watch on GitHub][github-watch-badge]][github-watch] @@ -608,6 +609,7 @@ Thanks goes to these people ([emoji key][emojis]): + This project follows the [all-contributors][all-contributors] specification. @@ -622,8 +624,8 @@ Contributions of any kind welcome! [npm]: https://www.npmjs.com/ [yarn]: https://classic.yarnpkg.com [node]: https://nodejs.org -[build-badge]: https://img.shields.io/travis/testing-library/react-testing-library.svg?style=flat-square -[build]: https://travis-ci.org/testing-library/react-testing-library +[build-badge]: https://img.shields.io/github/workflow/status/testing-library/react-testing-library/validate?logo=github&style=flat-square +[build]: https://github.com/testing-library/react-testing-library/actions?query=workflow%3Avalidate [coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/react-testing-library.svg?style=flat-square [coverage]: https://codecov.io/github/testing-library/react-testing-library [version-badge]: https://img.shields.io/npm/v/@testing-library/react.svg?style=flat-square @@ -644,6 +646,7 @@ Contributions of any kind welcome! [twitter-badge]: https://img.shields.io/twitter/url/https/github.com/testing-library/react-testing-library.svg?style=social [emojis]: https://github.com/all-contributors/all-contributors#emoji-key [all-contributors]: https://github.com/all-contributors/all-contributors +[all-contributors-badge]: https://img.shields.io/github/all-contributors/testing-library/react-testing-library?color=orange&style=flat-square [guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106 [bugs]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc [requests]: https://github.com/testing-library/react-testing-library/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3Aenhancement+is%3Aopen diff --git a/other/MAINTAINING.md b/other/MAINTAINING.md index 703126da..cade1c2a 100644 --- a/other/MAINTAINING.md +++ b/other/MAINTAINING.md @@ -32,9 +32,9 @@ any more of you than that. As a maintainer, you're fine to make your branches on the main repo or on your own fork. Either way is fine. -When we receive a pull request, a travis build is kicked off automatically (see -the `.travis.yml` for what runs in the travis build). We avoid merging anything -that breaks the travis build. +When we receive a pull request, a github action is kicked off automatically (see +the `.github/workflows/validate.yml` for what runs in the action). We avoid +merging anything that breaks the validate action. Please review PRs and focus on the code rather than the individual. You never 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. ## Release Our releases are automatic. They happen whenever code lands into `master`. A -travis build gets kicked off and if it's successful, a tool called +github action gets kicked off and if it's successful, a tool called [`semantic-release`](https://github.com/semantic-release/semantic-release) is used to automatically publish a new release to npm as well as a changelog to GitHub. It is only able to determine the version and whether a release is diff --git a/package.json b/package.json index 96c7df0f..086e82bc 100644 --- a/package.json +++ b/package.json @@ -43,18 +43,19 @@ "author": "Kent C. Dodds (https://kentcdodds.com)", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.12.1", + "@babel/runtime": "^7.12.5", "@testing-library/dom": "^7.26.6" }, "devDependencies": { - "@testing-library/jest-dom": "^5.11.5", - "@types/react-dom": "^16.9.8", + "@testing-library/jest-dom": "^5.11.6", + "@types/estree": "0.0.45", + "@types/react-dom": "^16.9.9", "dotenv-cli": "^4.0.0", - "dtslint": "4.0.4", - "kcd-scripts": "^6.6.0", + "dtslint": "4.0.5", + "kcd-scripts": "^7.0.3", "npm-run-all": "^4.1.5", - "react": "^16.13.1", - "react-dom": "^16.13.1", + "react": "^17.0.1", + "react-dom": "^17.0.1", "rimraf": "^3.0.2", "typescript": "^4.0.5" }, diff --git a/types/test.tsx b/types/test.tsx index c273feb0..3971037d 100644 --- a/types/test.tsx +++ b/types/test.tsx @@ -2,7 +2,7 @@ import * as React from 'react' import {render, fireEvent, screen, waitFor} from '@testing-library/react' import * as pure from '@testing-library/react/pure' -async function testRender() { +export async function testRender() { const page = render(
) // single queries @@ -17,9 +17,10 @@ async function testRender() { // helpers const {container, rerender, debug} = page + return {container, rerender, debug} } -async function testPureRender() { +export async function testPureRender() { const page = pure.render(
) // single queries @@ -34,20 +35,21 @@ async function testPureRender() { // helpers const {container, rerender, debug} = page + return {container, rerender, debug} } -async function testRenderOptions() { +export function testRenderOptions() { const container = document.createElement('div') const options = {container} render(
, options) } -async function testFireEvent() { +export function testFireEvent() { const {container} = render(