diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 50d61077..41dde974 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -9,7 +9,12 @@ on: - 'beta' - 'alpha' - '!all-contributors/**' - pull_request: {} + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: main: # ignore all-contributors PRs @@ -20,9 +25,6 @@ jobs: react: [16.9.0, ^16, ^17] runs-on: ubuntu-latest steps: - - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.1 - - name: ⬇️ Checkout repo uses: actions/checkout@v2 @@ -55,9 +57,6 @@ jobs: contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', github.ref) && github.event_name == 'push' }} steps: - - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.1 - - name: ⬇️ Checkout repo uses: actions/checkout@v2 diff --git a/README.md b/README.md index c9fca586..969e6bc7 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,22 @@ ## A Note about React 18 Support +If you are using the current version of `react-testing-library`, replace + +```js +import { renderHook } from '@testing-library/react-hooks' +``` + +with + +```js +import { renderHook } from '@testing-library/react' +``` + +Once replaced, `@testing-library/react-hooks` can be uninstalled. + +### Details + As part of the changes for React 18, it has been decided that the `renderHook` API provided by this library will instead be included as official additions to both `react-testing-library` ([PR](https://github.com/testing-library/react-testing-library/pull/991)) and diff --git a/docs/api-reference.md b/docs/api-reference.md index d8d36f89..6a95b87f 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -327,7 +327,7 @@ variable to `true` before importing `@testing-library/react-hooks` will also dis If you are using [a pure import](/installation#pure-imports), you are running your tests in an environment that does not support `beforeEach` and `afterEach`, or if the automatic suppression is not available to you for some other reason, then you can use the `suppressErrorOutput` export to -manually start and top suppress the output: +manually start and stop suppressing the output: ```ts import { renderHook, suppressErrorOutput } from '@testing-library/react-hooks/pure' diff --git a/docs/installation.md b/docs/installation.md index d83eed05..13104cfe 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -42,7 +42,7 @@ your hook. We currently support two different renderers: - `react-test-renderer` - `react-dom` -When using standard import for this library (show below), we will attempt to auto-detect which +When using standard import for this library (see below), we will attempt to auto-detect which renderer you have installed and use it without needing any specific wiring up to make it happen. If you have both installed in your project, and you use the standard import (see below) the library will default to using `react-test-renderer`. @@ -63,7 +63,7 @@ import { renderHook } from '@testing-library/react-hooks' ### Act Each render also provides a unique [`act` function](https://reactjs.org/docs/test-utils.html#act) -that cannot be used with other renderers. In order to simplify with `act `function you need to use, +that cannot be used with other renderers. In order to simplify which `act `function you need to use, we also export the correct one alongside the detected renderer for you: ```js @@ -73,8 +73,8 @@ import { renderHook, act } from '@testing-library/react-hooks' ## Being specific Auto-detection is great for simplifying setup and getting out of your way, but sometimes you do need -a little but more control. If a test needs requires a specific type of environment, the import can -be appended to force a specific renderer to be use. The supported environments are: +a little bit more control. If a test needs a specific type of environment, the import can +be appended to force a specific renderer to be used. The supported environments are: - `dom` - `native`