From c2d32b6fde39cc92212e1bdecc5460dcc324246c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Jul 2021 12:59:32 +1000 Subject: [PATCH 01/32] chore(deps-dev): bump typescript from 4.3.4 to 4.3.5 (#644) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.3.4 to 4.3.5. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.3.4...v4.3.5) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 56daa2b7..9ca8ee97 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "react-dom": "^17.0.1", "react-test-renderer": "17.0.2", "ts-node": "^10.0.0", - "typescript": "4.3.4" + "typescript": "4.3.5" }, "peerDependencies": { "react": ">=16.9.0", From 0c39e8a1503da6e62fefe21f83ba0456c891b746 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jul 2021 16:14:18 +1000 Subject: [PATCH 02/32] chore(deps-dev): bump eslint from 7.29.0 to 7.30.0 (#645) Bumps [eslint](https://github.com/eslint/eslint) from 7.29.0 to 7.30.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.29.0...v7.30.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9ca8ee97..a5d1d142 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "docz": "2.3.1", "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", - "eslint": "7.29.0", + "eslint": "7.30.0", "kcd-scripts": "11.1.0", "prettier": "^2.2.1", "react": "17.0.2", From be296267a81250667d0bfc8498bf05d2f5d829ef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 13:44:05 +1000 Subject: [PATCH 03/32] chore(deps-dev): bump eslint from 7.30.0 to 7.31.0 (#650) Bumps [eslint](https://github.com/eslint/eslint) from 7.30.0 to 7.31.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.30.0...v7.31.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5d1d142..fbe314bc 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "docz": "2.3.1", "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", - "eslint": "7.30.0", + "eslint": "7.31.0", "kcd-scripts": "11.1.0", "prettier": "^2.2.1", "react": "17.0.2", From fa859764d483c46d213c7905ab33179b3dfc23ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:38:53 +1000 Subject: [PATCH 04/32] chore(deps): bump codecov/codecov-action from 1 to 2.0.1 (#651) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 2.0.1. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v1...v2.0.1) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0144c34c..b121fcd4 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -41,7 +41,7 @@ jobs: run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2.0.1 release: needs: main From 2546dc2af8c281bb5dff70b43687b53322c50809 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Jul 2021 18:05:50 +1000 Subject: [PATCH 05/32] chore(deps-dev): bump codecov from 3.8.2 to 3.8.3 (#652) Bumps [codecov](https://github.com/codecov/codecov-node) from 3.8.2 to 3.8.3. - [Release notes](https://github.com/codecov/codecov-node/releases) - [Changelog](https://github.com/codecov/codecov-node/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-node/compare/v3.8.2...v3.8.3) --- updated-dependencies: - dependency-name: codecov dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fbe314bc..9751b608 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@typescript-eslint/eslint-plugin": "^4.9.1", "@typescript-eslint/parser": "^4.9.1", "all-contributors-cli": "6.20.0", - "codecov": "3.8.2", + "codecov": "3.8.3", "docz": "2.3.1", "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", From 170f64c1af5184e0f24cba385c266a1b6e933e32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Jul 2021 15:18:27 +1000 Subject: [PATCH 06/32] chore(deps-dev): bump kcd-scripts from 11.1.0 to 11.2.0 (#653) Bumps [kcd-scripts](https://github.com/kentcdodds/kcd-scripts) from 11.1.0 to 11.2.0. - [Release notes](https://github.com/kentcdodds/kcd-scripts/releases) - [Changelog](https://github.com/kentcdodds/kcd-scripts/blob/main/CHANGELOG.md) - [Commits](https://github.com/kentcdodds/kcd-scripts/compare/v11.1.0...v11.2.0) --- updated-dependencies: - dependency-name: kcd-scripts dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9751b608..9d9c0928 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", "eslint": "7.31.0", - "kcd-scripts": "11.1.0", + "kcd-scripts": "11.2.0", "prettier": "^2.2.1", "react": "17.0.2", "react-dom": "^17.0.1", From 73518f96af58d2692cea82ecdfd725ca521dad09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jul 2021 18:58:32 +1000 Subject: [PATCH 07/32] chore(deps): bump codecov/codecov-action from 2.0.1 to 2.0.2 (#657) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.0.1...v2.0.2) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b121fcd4..c9143fba 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -41,7 +41,7 @@ jobs: run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v2.0.1 + uses: codecov/codecov-action@v2.0.2 release: needs: main From 77792feb9054ce50a7a147c0a2469db04215a6f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 12:49:11 +1000 Subject: [PATCH 08/32] chore(deps): bump styfle/cancel-workflow-action from 0.9.0 to 0.9.1 (#659) Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.9.0 to 0.9.1. - [Release notes](https://github.com/styfle/cancel-workflow-action/releases) - [Commits](https://github.com/styfle/cancel-workflow-action/compare/0.9.0...0.9.1) --- updated-dependencies: - dependency-name: styfle/cancel-workflow-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index c9143fba..ed3d3724 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo uses: actions/checkout@v2 @@ -52,7 +52,7 @@ jobs: github.event_name == 'push' }} steps: - name: 🛑 Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 - name: ⬇️ Checkout repo uses: actions/checkout@v2 From 089a3d9433b938398bb849ef0027e6fd68b8241a Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Fri, 30 Jul 2021 21:26:34 +1000 Subject: [PATCH 09/32] docs: fix for failing docz build (#660) --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9d9c0928..d632b898 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", "eslint": "7.31.0", + "get-pkg-repo": "4.1.1", "kcd-scripts": "11.2.0", "prettier": "^2.2.1", "react": "17.0.2", From a54eeb3c529feeda09443118f3ffba7195318935 Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Fri, 30 Jul 2021 21:48:43 +1000 Subject: [PATCH 10/32] chore(deps): pin all dev deps (#661) --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d632b898..797f1ff3 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.9.1", - "@typescript-eslint/parser": "^4.9.1", + "@typescript-eslint/eslint-plugin": "4.28.5", + "@typescript-eslint/parser": "4.28.5", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "docz": "2.3.1", @@ -63,11 +63,11 @@ "eslint": "7.31.0", "get-pkg-repo": "4.1.1", "kcd-scripts": "11.2.0", - "prettier": "^2.2.1", + "prettier": "2.3.2", "react": "17.0.2", - "react-dom": "^17.0.1", + "react-dom": "17.0.2", "react-test-renderer": "17.0.2", - "ts-node": "^10.0.0", + "ts-node": "10.1.0", "typescript": "4.3.5" }, "peerDependencies": { From 7273ba4fb22d43baf84ae87fa0d2e491ed446309 Mon Sep 17 00:00:00 2001 From: Chris Chen Date: Fri, 30 Jul 2021 05:19:36 -0700 Subject: [PATCH 11/32] test: add tests to prove jest useFakeTimers is supported (#641) Co-authored-by: Lei Chen Co-authored-by: Michael Peyper --- src/__tests__/asyncHook.fakeTimers.test.ts | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/__tests__/asyncHook.fakeTimers.test.ts diff --git a/src/__tests__/asyncHook.fakeTimers.test.ts b/src/__tests__/asyncHook.fakeTimers.test.ts new file mode 100644 index 00000000..98d6b2c9 --- /dev/null +++ b/src/__tests__/asyncHook.fakeTimers.test.ts @@ -0,0 +1,58 @@ +describe('async hook (fake timers) tests', () => { + beforeEach(() => { + jest.useFakeTimers() + }) + + afterEach(() => { + jest.useRealTimers() + }) + + runForRenderers(['default', 'dom', 'native', 'server/hydrated'], ({ renderHook }) => { + test('should wait for arbitrary expectation to pass when using advanceTimersByTime()', async () => { + const { waitFor } = renderHook(() => null) + + let actual = 0 + const expected = 1 + + setTimeout(() => { + actual = expected + }, 200) + + let complete = false + + jest.advanceTimersByTime(200) + + await waitFor(() => { + expect(actual).toBe(expected) + complete = true + }) + + expect(complete).toBe(true) + }) + + test('should wait for arbitrary expectation to pass when using runOnlyPendingTimers()', async () => { + const { waitFor } = renderHook(() => null) + + let actual = 0 + const expected = 1 + + setTimeout(() => { + actual = expected + }, 200) + + let complete = false + + jest.runOnlyPendingTimers() + + await waitFor(() => { + expect(actual).toBe(expected) + complete = true + }) + + expect(complete).toBe(true) + }) + }) +}) + +// eslint-disable-next-line jest/no-export +export {} From ea92648785f407729d6f188fa81f77f492e28b41 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 22:20:21 +1000 Subject: [PATCH 12/32] docs: add chris110408 as a contributor for test, test, test (#662) * docs: update README.md [skip ci] * docs: update .all-contributorsrc [skip ci] 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 9c318f40..098d70cd 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -566,6 +566,15 @@ "bug", "review" ] + }, + { + "login": "chris110408", + "name": "Chris Chen", + "avatar_url": "https://avatars.githubusercontent.com/u/10645051?v=4", + "profile": "https://github.com/chris110408", + "contributions": [ + "test" + ] } ], "skipCi": true, diff --git a/README.md b/README.md index e3bba708..7117e70b 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Matan Borenkraout

🚧
andyrooger

💻
Bryan Wain

🐛 👀 +
Chris Chen

⚠️ From d946e3c202d8d19571da77d37982c7a011f00a1a Mon Sep 17 00:00:00 2001 From: Robert Snow Date: Sun, 1 Aug 2021 05:25:59 -0700 Subject: [PATCH 13/32] test: run test against multiple versions of React (#663) * Test against multiple versions of React * add to contributors * chore(scripts): add extra install scripts for other react versions Co-authored-by: Michael Peyper --- .all-contributorsrc | 9 +++++++++ .github/workflows/validate.yml | 4 ++++ README.md | 1 + package.json | 6 ++++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 098d70cd..0f175cdb 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -567,6 +567,15 @@ "review" ] }, + { + "login": "snowystinger", + "name": "Robert Snow", + "avatar_url": "https://avatars.githubusercontent.com/u/698229?v=4", + "profile": "https://github.com/snowystinger", + "contributions": [ + "test" + ] + }, { "login": "chris110408", "name": "Chris Chen", diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ed3d3724..2bdcf04e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,6 +17,7 @@ jobs: strategy: matrix: node: [12.13, 12, 14, 16] + react: [16.9.0, ^16, ^17] runs-on: ubuntu-latest steps: - name: 🛑 Cancel Previous Runs @@ -37,6 +38,9 @@ jobs: env: HUSKY_SKIP_INSTALL: true + - name: Use React version + run: npm install --save-dev react@"${{ matrix.react }}" react-dom@"${{ matrix.react }}" react-test-renderer@"${{ matrix.react }}" + - name: ▶️ Run validate script run: npm run validate diff --git a/README.md b/README.md index 7117e70b..eb79ae8b 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Matan Borenkraout

🚧
andyrooger

💻
Bryan Wain

🐛 👀 +
Robert Snow

⚠️
Chris Chen

⚠️ diff --git a/package.json b/package.json index 797f1ff3..ba03720e 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,6 @@ "scripts": { "setup": "npm install && npm run validate -s", "validate": "kcd-scripts validate", - "prepare": "npm run build", "build": "kcd-scripts build --out-dir lib && npm run generate:submodules", "generate:submodules": "ts-node scripts/generate-submodules.ts", "test": "kcd-scripts test", @@ -43,7 +42,10 @@ "coverage": "codecov", "docs:dev": "docz dev", "docs:build": "docz build", - "contributors:add": "all-contributors add" + "contributors:add": "all-contributors add", + "install:react-16-9": "npm install --no-save react@16.9.0 react-dom@16.9.0 react-test-renderer@16.9.0", + "install:react-16": "npm install --no-save react@^16 react-dom@^16 react-test-renderer@^16", + "install:react-17": "npm install --no-save react@^17 react-dom@^17 react-test-renderer@^17" }, "dependencies": { "@babel/runtime": "^7.12.5", From 238a9ea184f68cba3d0dbfe3aef883174b61161c Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Sun, 1 Aug 2021 23:46:18 +1000 Subject: [PATCH 14/32] chore(ci): clean up validate scripts to remove duplication (#664) --- .github/workflows/validate.yml | 4 ++-- package.json | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 2bdcf04e..b6d12ed5 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -38,8 +38,8 @@ jobs: env: HUSKY_SKIP_INSTALL: true - - name: Use React version - run: npm install --save-dev react@"${{ matrix.react }}" react-dom@"${{ matrix.react }}" react-test-renderer@"${{ matrix.react }}" + - name: ⚛️ Use React version + run: REACT_VERSION=${{ matrix.react }} npm run install:react - name: ▶️ Run validate script run: npm run validate diff --git a/package.json b/package.json index ba03720e..4f36440a 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,10 @@ "docs:dev": "docz dev", "docs:build": "docz build", "contributors:add": "all-contributors add", - "install:react-16-9": "npm install --no-save react@16.9.0 react-dom@16.9.0 react-test-renderer@16.9.0", - "install:react-16": "npm install --no-save react@^16 react-dom@^16 react-test-renderer@^16", - "install:react-17": "npm install --no-save react@^17 react-dom@^17 react-test-renderer@^17" + "install:react": "npm install --no-save react@${REACT_VERSION:-latest} react-dom@${REACT_VERSION:-latest} react-test-renderer@${REACT_VERSION:-latest}", + "install:react-16.9.0": "cross-env REACT_VERSION=16.9.0 npm run install:react", + "install:react-16": "cross-env REACT_VERSION=^16 npm run install:react", + "install:react-17": "cross-env REACT_VERSION=^17 npm run install:react" }, "dependencies": { "@babel/runtime": "^7.12.5", @@ -59,6 +60,7 @@ "@typescript-eslint/parser": "4.28.5", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", + "cross-env": "^7.0.3", "docz": "2.3.1", "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", From 528c288a2ac391020c38197fd4f227ab4e051ccf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Aug 2021 08:21:49 +0100 Subject: [PATCH 15/32] chore(deps-dev): bump eslint from 7.31.0 to 7.32.0 (#665) Bumps [eslint](https://github.com/eslint/eslint) from 7.31.0 to 7.32.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v7.31.0...v7.32.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f36440a..b0fc7087 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "docz": "2.3.1", "docz-theme-default": "1.2.0", "docz-utils": "2.3.0", - "eslint": "7.31.0", + "eslint": "7.32.0", "get-pkg-repo": "4.1.1", "kcd-scripts": "11.2.0", "prettier": "2.3.2", From fe6040bb78f006685775a36d29dbd309dab560f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 08:44:12 +0100 Subject: [PATCH 16/32] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#667) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.28.5 to 4.29.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0fc7087..5c7bc475 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "4.28.5", + "@typescript-eslint/eslint-plugin": "4.29.0", "@typescript-eslint/parser": "4.28.5", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", From 95d234050f465a7cb3f191ab66c47950dacaeee2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:14:10 +0100 Subject: [PATCH 17/32] chore(deps-dev): bump @typescript-eslint/parser from 4.28.5 to 4.29.0 (#668) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.28.5 to 4.29.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c7bc475..f4076dbd 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.29.0", - "@typescript-eslint/parser": "4.28.5", + "@typescript-eslint/parser": "4.29.0", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "cross-env": "^7.0.3", From 3f944e36b9811ecb5d4518492b928946cde0947d Mon Sep 17 00:00:00 2001 From: Masious Date: Sat, 7 Aug 2021 23:02:39 +0430 Subject: [PATCH 18/32] chore: Pr/fix typo in docs (#671) * Changes "The current value or" to "the current value of" in the docs * Adds masious as a contributor Co-authored-by: Masoud Bonabi --- .all-contributorsrc | 9 +++++++++ README.md | 1 + docs/api-reference.md | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 0f175cdb..5ea4dc36 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -584,6 +584,15 @@ "contributions": [ "test" ] + }, + { + "login": "masious", + "name": "Masious", + "avatar_url": "https://avatars.githubusercontent.com/u/6429009?v=4", + "profile": "https://www.facebook.com/masoud.bonabi", + "contributions": [ + "doc" + ] } ], "skipCi": true, diff --git a/README.md b/README.md index eb79ae8b..88f0944b 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Bryan Wain

🐛 👀
Robert Snow

⚠️
Chris Chen

⚠️ +
Masious

📖 diff --git a/docs/api-reference.md b/docs/api-reference.md index 7416d1f7..d8d36f89 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -68,7 +68,7 @@ The `renderHook` function returns an object that has the following properties: } ``` -The `current` value or the `result` will reflect the latest of whatever is returned from the +The `current` value of the `result` will reflect the latest of whatever is returned from the `callback` passed to `renderHook`. Any thrown values from the latest call will be reflected in the `error` value of the `result`. The `all` value is an array containing all the returns (including the most recent) from the callback. These could be `result` or an `error` depending on what the callback From 88b21e0a47572857480e573c834011420a1e7e7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 08:38:10 +0100 Subject: [PATCH 19/32] chore(deps-dev): bump @typescript-eslint/parser from 4.29.0 to 4.29.1 (#673) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.0 to 4.29.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4076dbd..b9849e51 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.29.0", - "@typescript-eslint/parser": "4.29.0", + "@typescript-eslint/parser": "4.29.1", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "cross-env": "^7.0.3", From fe3c938a937d366cf191c00a2c064057e78e73d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 08:49:08 +0100 Subject: [PATCH 20/32] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#674) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.0 to 4.29.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b9849e51..ea873f16 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "4.29.0", + "@typescript-eslint/eslint-plugin": "4.29.1", "@typescript-eslint/parser": "4.29.1", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", From 50b8d5d227f83034b8a38b4bb30548ed63efa370 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 23:07:58 +1000 Subject: [PATCH 21/32] chore(deps-dev): bump ts-node from 10.1.0 to 10.2.0 (#672) Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.1.0 to 10.2.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v10.1.0...v10.2.0) --- updated-dependencies: - dependency-name: ts-node dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Josh <37798644+joshuaellis@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea873f16..4252476b 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "react": "17.0.2", "react-dom": "17.0.2", "react-test-renderer": "17.0.2", - "ts-node": "10.1.0", + "ts-node": "10.2.0", "typescript": "4.3.5" }, "peerDependencies": { From 58ced9087e40e6831fb8d1dbe2dd5ac145f5f740 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 08:59:03 +0100 Subject: [PATCH 22/32] chore(deps-dev): bump @typescript-eslint/parser from 4.29.1 to 4.29.2 (#675) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.1 to 4.29.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.2/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4252476b..d41c7d2b 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.29.1", - "@typescript-eslint/parser": "4.29.1", + "@typescript-eslint/parser": "4.29.2", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "cross-env": "^7.0.3", From f3f4de7a8c8234a52bb28adb82270bfe01de6589 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Aug 2021 09:21:51 +0100 Subject: [PATCH 23/32] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#676) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.1 to 4.29.2. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.2/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d41c7d2b..1144fe6a 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "4.29.1", + "@typescript-eslint/eslint-plugin": "4.29.2", "@typescript-eslint/parser": "4.29.2", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", From 97a031ffb022b6a54f15dc32ebeb7b74cddac41c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:08:46 +1000 Subject: [PATCH 24/32] chore(deps-dev): bump ts-node from 10.2.0 to 10.2.1 (#677) Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 10.2.0 to 10.2.1. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v10.2.0...v10.2.1) --- updated-dependencies: - dependency-name: ts-node dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1144fe6a..1a99afa9 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "react": "17.0.2", "react-dom": "17.0.2", "react-test-renderer": "17.0.2", - "ts-node": "10.2.0", + "ts-node": "10.2.1", "typescript": "4.3.5" }, "peerDependencies": { From fae4e7779511224f82acec7dfedddafb5e0abcde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 09:59:20 +1000 Subject: [PATCH 25/32] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#678) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.2 to 4.29.3. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.3/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a99afa9..188d5784 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "4.29.2", + "@typescript-eslint/eslint-plugin": "4.29.3", "@typescript-eslint/parser": "4.29.2", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", From 3a858434a83ba30ad7d5a5d23a84e141460b02ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 08:33:16 +0100 Subject: [PATCH 26/32] chore(deps): bump codecov/codecov-action from 2.0.2 to 2.0.3 (#680) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2.0.2 to 2.0.3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2.0.2...v2.0.3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index b6d12ed5..37aacd7e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -45,7 +45,7 @@ jobs: run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v2.0.2 + uses: codecov/codecov-action@v2.0.3 release: needs: main From 73e265c15c23f6f1bd02dca454575b94faf035cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 17:42:51 +1000 Subject: [PATCH 27/32] chore(deps-dev): bump @typescript-eslint/parser from 4.29.2 to 4.29.3 (#679) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.2 to 4.29.3. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.3/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 188d5784..98896637 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.29.3", - "@typescript-eslint/parser": "4.29.2", + "@typescript-eslint/parser": "4.29.3", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "cross-env": "^7.0.3", From cb259d18ac5d369f0d3e7007aa06fc9a5a4ccb21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Aug 2021 08:37:09 +0100 Subject: [PATCH 28/32] chore(deps-dev): bump typescript from 4.3.5 to 4.4.2 (#681) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.3.5 to 4.4.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.3.5...v4.4.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 98896637..8e2143b5 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "react-dom": "17.0.2", "react-test-renderer": "17.0.2", "ts-node": "10.2.1", - "typescript": "4.3.5" + "typescript": "4.4.2" }, "peerDependencies": { "react": ">=16.9.0", From 084bb662e7cdf8b645fd8449d0629e218190968d Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Mon, 30 Aug 2021 10:03:38 +1000 Subject: [PATCH 29/32] test(renderers): fix test util to use correct renderers for pure tests --- src/__tests__/utils/runForRenderers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__tests__/utils/runForRenderers.ts b/src/__tests__/utils/runForRenderers.ts index c0375f4d..13c9aa92 100644 --- a/src/__tests__/utils/runForRenderers.ts +++ b/src/__tests__/utils/runForRenderers.ts @@ -58,8 +58,8 @@ const rendererResolvers = { native: () => requireRenderer('native'), server: () => requireRenderer('server'), 'default/pure': () => requireRenderer('default/pure'), - 'dom/pure': () => requireRenderer('default/pure'), - 'native/pure': () => requireRenderer('default/pure'), + 'dom/pure': () => requireRenderer('dom/pure'), + 'native/pure': () => requireRenderer('native/pure'), 'server/pure': () => requireRenderer('server/pure'), 'server/hydrated': () => hydratedServerRenderer('server'), 'server/hydrated/pure': () => hydratedServerRenderer('server/pure') From f786b9505d8a27921ba51133d594d7627388fd18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 10:40:26 +0100 Subject: [PATCH 30/32] chore(deps-dev): bump @typescript-eslint/parser from 4.29.3 to 4.30.0 (#683) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.3 to 4.30.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.30.0/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e2143b5..716536d5 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.29.3", - "@typescript-eslint/parser": "4.29.3", + "@typescript-eslint/parser": "4.30.0", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", "cross-env": "^7.0.3", From b869640154dfaf7e4bbbf6f7b4461ec5c3238c0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Aug 2021 11:08:30 +0100 Subject: [PATCH 31/32] chore(deps-dev): bump @typescript-eslint/eslint-plugin (#684) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.3 to 4.30.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.30.0/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 716536d5..3a854f40 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "react-error-boundary": "^3.1.0" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "4.29.3", + "@typescript-eslint/eslint-plugin": "4.30.0", "@typescript-eslint/parser": "4.30.0", "all-contributors-cli": "6.20.0", "codecov": "3.8.3", From 4a037040e5d9d806a9d7a9c8fd3fc3b243e4617f Mon Sep 17 00:00:00 2001 From: Michael Peyper Date: Tue, 31 Aug 2021 21:25:26 +1000 Subject: [PATCH 32/32] fix(async-utils): prevent timeout and interval checks in wait from leaving open handles (#682) * fix(async-utils): prevent timeout and interval checks in wait from leaving open handles * refactor(async-utils): rename timeoutSignal to timeoutController --- src/core/asyncUtils.ts | 33 ++++++++-------------- src/helpers/createTimeoutController.ts | 39 ++++++++++++++++++++++++++ src/helpers/promises.ts | 10 ------- 3 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 src/helpers/createTimeoutController.ts delete mode 100644 src/helpers/promises.ts diff --git a/src/core/asyncUtils.ts b/src/core/asyncUtils.ts index fe44c715..a7424036 100644 --- a/src/core/asyncUtils.ts +++ b/src/core/asyncUtils.ts @@ -7,7 +7,7 @@ import { AsyncUtils } from '../types' -import { resolveAfter, callAfter } from '../helpers/promises' +import { createTimeoutController } from '../helpers/createTimeoutController' import { TimeoutError } from '../helpers/error' const DEFAULT_INTERVAL = 50 @@ -20,37 +20,26 @@ function asyncUtils(act: Act, addResolver: (callback: () => void) => void): Asyn return callbackResult ?? callbackResult === undefined } + const timeoutSignal = createTimeoutController(timeout) + const waitForResult = async () => { while (true) { - await Promise.race( - [ - new Promise((resolve) => addResolver(resolve)), - interval && resolveAfter(interval) - ].filter(Boolean) - ) - - if (checkResult()) { + const intervalSignal = createTimeoutController(interval) + timeoutSignal.onTimeout(() => intervalSignal.cancel()) + + await intervalSignal.wrap(new Promise(addResolver)) + + if (checkResult() || timeoutSignal.timedOut) { return } } } - let timedOut = false - if (!checkResult()) { - if (timeout) { - const timeoutPromise = () => - callAfter(() => { - timedOut = true - }, timeout) - - await act(() => Promise.race([waitForResult(), timeoutPromise()])) - } else { - await act(waitForResult) - } + await act(() => timeoutSignal.wrap(waitForResult())) } - return !timedOut + return !timeoutSignal.timedOut } const waitFor = async ( diff --git a/src/helpers/createTimeoutController.ts b/src/helpers/createTimeoutController.ts new file mode 100644 index 00000000..643d3768 --- /dev/null +++ b/src/helpers/createTimeoutController.ts @@ -0,0 +1,39 @@ +import { WaitOptions } from '../types' + +function createTimeoutController(timeout: WaitOptions['timeout']) { + let timeoutId: NodeJS.Timeout + const timeoutCallbacks: Array<() => void> = [] + + const timeoutController = { + onTimeout(callback: () => void) { + timeoutCallbacks.push(callback) + }, + wrap(promise: Promise) { + return new Promise((resolve, reject) => { + timeoutController.timedOut = false + timeoutController.onTimeout(resolve) + + if (timeout) { + timeoutId = setTimeout(() => { + timeoutController.timedOut = true + timeoutCallbacks.forEach((callback) => callback()) + resolve() + }, timeout) + } + + promise + .then(resolve) + .catch(reject) + .finally(() => timeoutController.cancel()) + }) + }, + cancel() { + clearTimeout(timeoutId) + }, + timedOut: false + } + + return timeoutController +} + +export { createTimeoutController } diff --git a/src/helpers/promises.ts b/src/helpers/promises.ts deleted file mode 100644 index 2fa89e5f..00000000 --- a/src/helpers/promises.ts +++ /dev/null @@ -1,10 +0,0 @@ -function resolveAfter(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)) -} - -async function callAfter(callback: () => void, ms: number) { - await resolveAfter(ms) - callback() -} - -export { resolveAfter, callAfter }