Skip to content

Commit 274932b

Browse files
committed
Merge branch 'main' into react-18-upgrade
# Conflicts: # .github/workflows/validate.yml # package.json
2 parents ea9d4f9 + 528c288 commit 274932b

File tree

5 files changed

+94
-12
lines changed

5 files changed

+94
-12
lines changed

.all-contributorsrc

+18
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,24 @@
566566
"bug",
567567
"review"
568568
]
569+
},
570+
{
571+
"login": "snowystinger",
572+
"name": "Robert Snow",
573+
"avatar_url": "https://avatars.githubusercontent.com/u/698229?v=4",
574+
"profile": "https://github.com/snowystinger",
575+
"contributions": [
576+
"test"
577+
]
578+
},
579+
{
580+
"login": "chris110408",
581+
"name": "Chris Chen",
582+
"avatar_url": "https://avatars.githubusercontent.com/u/10645051?v=4",
583+
"profile": "https://github.com/chris110408",
584+
"contributions": [
585+
"test"
586+
]
569587
}
570588
],
571589
"skipCi": true,

.github/workflows/validate.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: 🛑 Cancel Previous Runs
26-
uses: styfle/[email protected].0
26+
uses: styfle/[email protected].1
2727

2828
- name: ⬇️ Checkout repo
2929
uses: actions/checkout@v2
@@ -40,14 +40,14 @@ jobs:
4040
env:
4141
HUSKY_SKIP_INSTALL: true
4242

43-
- name: Use React version
44-
run: npm install --save-dev react@"${{ matrix.react }}" react-dom@"${{ matrix.react }}" react-test-renderer@"${{ matrix.react }}"
43+
- name: ⚛️ Use React version
44+
run: REACT_VERSION=${{ matrix.react }} npm run install:react
4545

4646
- name: ▶️ Run validate script
4747
run: npm run validate
4848

4949
- name: ⬆️ Upload coverage report
50-
uses: codecov/[email protected].1
50+
uses: codecov/[email protected].2
5151

5252
release:
5353
needs: main
@@ -58,7 +58,7 @@ jobs:
5858
github.event_name == 'push' }}
5959
steps:
6060
- name: 🛑 Cancel Previous Runs
61-
uses: styfle/[email protected].0
61+
uses: styfle/[email protected].1
6262

6363
- name: ⬇️ Checkout repo
6464
uses: actions/checkout@v2

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
246246
<td align="center"><a href="https://matan.io"><img src="https://avatars.githubusercontent.com/u/12711091?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matan Borenkraout</b></sub></a><br /><a href="#maintenance-MatanBobi" title="Maintenance">🚧</a></td>
247247
<td align="center"><a href="https://github.com/andyrooger"><img src="https://avatars.githubusercontent.com/u/420834?v=4?s=100" width="100px;" alt=""/><br /><sub><b>andyrooger</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=andyrooger" title="Code">💻</a></td>
248248
<td align="center"><a href="https://github.com/bdwain"><img src="https://avatars.githubusercontent.com/u/3982094?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Bryan Wain</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/issues?q=author%3Abdwain" title="Bug reports">🐛</a> <a href="https://github.com/testing-library/react-hooks-testing-library/pulls?q=is%3Apr+reviewed-by%3Abdwain" title="Reviewed Pull Requests">👀</a></td>
249+
<td align="center"><a href="https://github.com/snowystinger"><img src="https://avatars.githubusercontent.com/u/698229?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Robert Snow</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=snowystinger" title="Tests">⚠️</a></td>
250+
<td align="center"><a href="https://github.com/chris110408"><img src="https://avatars.githubusercontent.com/u/10645051?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Chris Chen</b></sub></a><br /><a href="https://github.com/testing-library/react-hooks-testing-library/commits?author=chris110408" title="Tests">⚠️</a></td>
249251
</tr>
250252
</table>
251253

package.json

+11-7
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343
"docs:dev": "docz dev",
4444
"docs:build": "docz build",
4545
"contributors:add": "all-contributors add",
46-
"install-16": "npm install --save-dev react@\"^16.9.0\" react-dom@\"^16.9.0\" react-test-renderer@\"^16.9.0\"",
47-
"install-next": "npm install --save-dev react@next react-dom@next react-test-renderer@next"
46+
"install:react": "npm install --no-save react@${REACT_VERSION:-latest} react-dom@${REACT_VERSION:-latest} react-test-renderer@${REACT_VERSION:-latest}",
47+
"install:react-16.9.0": "cross-env REACT_VERSION=16.9.0 npm run install:react",
48+
"install:react-16": "cross-env REACT_VERSION=^16 npm run install:react",
49+
"install:react-17": "cross-env REACT_VERSION=^17 npm run install:react"
4850
},
4951
"dependencies": {
5052
"@babel/runtime": "^7.12.5",
@@ -54,20 +56,22 @@
5456
"react-error-boundary": "^3.1.0"
5557
},
5658
"devDependencies": {
57-
"@typescript-eslint/eslint-plugin": "^4.9.1",
58-
"@typescript-eslint/parser": "^4.9.1",
59+
"@typescript-eslint/eslint-plugin": "4.28.5",
60+
"@typescript-eslint/parser": "4.28.5",
5961
"all-contributors-cli": "6.20.0",
6062
"codecov": "3.8.3",
63+
"cross-env": "^7.0.3",
6164
"docz": "2.3.1",
6265
"docz-theme-default": "1.2.0",
6366
"docz-utils": "2.3.0",
64-
"eslint": "7.31.0",
67+
"eslint": "7.32.0",
68+
"get-pkg-repo": "4.1.1",
6569
"kcd-scripts": "11.2.0",
66-
"prettier": "^2.2.1",
70+
"prettier": "2.3.2",
6771
"react": "17.0.2",
6872
"react-dom": "17.0.2",
6973
"react-test-renderer": "17.0.2",
70-
"ts-node": "^10.0.0",
74+
"ts-node": "10.1.0",
7175
"typescript": "4.3.5"
7276
},
7377
"peerDependencies": {
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
describe('async hook (fake timers) tests', () => {
2+
beforeEach(() => {
3+
jest.useFakeTimers()
4+
})
5+
6+
afterEach(() => {
7+
jest.useRealTimers()
8+
})
9+
10+
runForRenderers(['default', 'dom', 'native', 'server/hydrated'], ({ renderHook }) => {
11+
test('should wait for arbitrary expectation to pass when using advanceTimersByTime()', async () => {
12+
const { waitFor } = renderHook(() => null)
13+
14+
let actual = 0
15+
const expected = 1
16+
17+
setTimeout(() => {
18+
actual = expected
19+
}, 200)
20+
21+
let complete = false
22+
23+
jest.advanceTimersByTime(200)
24+
25+
await waitFor(() => {
26+
expect(actual).toBe(expected)
27+
complete = true
28+
})
29+
30+
expect(complete).toBe(true)
31+
})
32+
33+
test('should wait for arbitrary expectation to pass when using runOnlyPendingTimers()', async () => {
34+
const { waitFor } = renderHook(() => null)
35+
36+
let actual = 0
37+
const expected = 1
38+
39+
setTimeout(() => {
40+
actual = expected
41+
}, 200)
42+
43+
let complete = false
44+
45+
jest.runOnlyPendingTimers()
46+
47+
await waitFor(() => {
48+
expect(actual).toBe(expected)
49+
complete = true
50+
})
51+
52+
expect(complete).toBe(true)
53+
})
54+
})
55+
})
56+
57+
// eslint-disable-next-line jest/no-export
58+
export {}

0 commit comments

Comments
 (0)