diff --git a/.all-contributorsrc b/.all-contributorsrc
index c9aecfcd..b8a61f52 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -145,7 +145,8 @@
"avatar_url": "https://avatars3.githubusercontent.com/u/3806031?v=4",
"profile": "https://jsjoe.io",
"contributions": [
- "tutorial"
+ "tutorial",
+ "test"
]
},
{
diff --git a/README.md b/README.md
index a903beb5..c9fca586 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,7 @@ library will instead be included as official additions to both `react-testing-li
to provide a more cohesive and consistent implementation for our users.
Please be patient as we finalise these changes in the respective testing libraries.
+In the mean time you can install `@testing-library/react@^13.1`
## Table of Contents
@@ -197,7 +198,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
 Vince Malone 💻 |
 Sebastian Weber 📝 |
 Christian Gill 📖 |
-  JavaScript Joe ✅ |
+  JavaScript Joe ✅ ⚠️ |
 Sarah Dayan 📦 |
diff --git a/src/__tests__/ssr.test.ts b/src/__tests__/ssr.test.ts
new file mode 100644
index 00000000..1119d1a1
--- /dev/null
+++ b/src/__tests__/ssr.test.ts
@@ -0,0 +1,18 @@
+/**
+ * @jest-environment node
+ */
+import { useState } from 'react'
+
+// This verifies that renderHook can be called in
+// a SSR-like environment.
+describe('renderHook', () => {
+ function useLoading() {
+ const [loading, setLoading] = useState(false)
+ return { loading, setLoading }
+ }
+ runForRenderers(['server'], ({ renderHook }) => {
+ test('should not throw in SSR environment', () => {
+ expect(() => renderHook(() => useLoading())).not.toThrowError('document is not defined')
+ })
+ })
+})
diff --git a/src/server/pure.ts b/src/server/pure.ts
index 1978f2d0..aa62a283 100644
--- a/src/server/pure.ts
+++ b/src/server/pure.ts
@@ -13,19 +13,17 @@ function createServerRenderer(
) {
let renderProps: TProps | undefined
let container: HTMLDivElement | undefined
- let serverOutput: string = ''
+ let serverOutput = ''
const testHarness = createTestHarness(rendererProps, wrapper, false)
return {
render(props?: TProps) {
renderProps = props
- act(() => {
- try {
- serverOutput = ReactDOMServer.renderToString(testHarness(props))
- } catch (e: unknown) {
- rendererProps.setError(e as Error)
- }
- })
+ try {
+ serverOutput = ReactDOMServer.renderToString(testHarness(props))
+ } catch (e: unknown) {
+ rendererProps.setError(e as Error)
+ }
},
hydrate() {
if (container) {