Skip to content

Commit 530c47e

Browse files
authored
Merge branch 'main' into support-testing-multiple-versions
2 parents a55122c + ea92648 commit 530c47e

File tree

5 files changed

+76
-7
lines changed

5 files changed

+76
-7
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,15 @@
575575
"contributions": [
576576
"test"
577577
]
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+
]
578587
}
579588
],
580589
"skipCi": true,

.github/workflows/validate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- name: 🛑 Cancel Previous Runs
24-
uses: styfle/[email protected].0
24+
uses: styfle/[email protected].1
2525

2626
- name: ⬇️ Checkout repo
2727
uses: actions/checkout@v2
@@ -45,7 +45,7 @@ jobs:
4545
run: npm run validate
4646

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

5050
release:
5151
needs: main
@@ -56,7 +56,7 @@ jobs:
5656
github.event_name == 'push' }}
5757
steps:
5858
- name: 🛑 Cancel Previous Runs
59-
uses: styfle/[email protected].0
59+
uses: styfle/[email protected].1
6060

6161
- name: ⬇️ Checkout repo
6262
uses: actions/checkout@v2

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
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>
249249
<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>
250251
</tr>
251252
</table>
252253

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,21 @@
5353
"react-error-boundary": "^3.1.0"
5454
},
5555
"devDependencies": {
56-
"@typescript-eslint/eslint-plugin": "^4.9.1",
57-
"@typescript-eslint/parser": "^4.9.1",
56+
"@typescript-eslint/eslint-plugin": "4.28.5",
57+
"@typescript-eslint/parser": "4.28.5",
5858
"all-contributors-cli": "6.20.0",
5959
"codecov": "3.8.3",
6060
"docz": "2.3.1",
6161
"docz-theme-default": "1.2.0",
6262
"docz-utils": "2.3.0",
6363
"eslint": "7.31.0",
64+
"get-pkg-repo": "4.1.1",
6465
"kcd-scripts": "11.2.0",
65-
"prettier": "^2.2.1",
66+
"prettier": "2.3.2",
6667
"react": "17.0.2",
6768
"react-dom": "17.0.2",
6869
"react-test-renderer": "17.0.2",
69-
"ts-node": "^10.0.0",
70+
"ts-node": "10.1.0",
7071
"typescript": "4.3.5"
7172
},
7273
"peerDependencies": {
Lines changed: 58 additions & 0 deletions
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)