Skip to content

Commit aa73ee9

Browse files
committed
fix: improve error message when auto-detection fails to mention bundlers
Fixes #544
1 parent d980fc0 commit aa73ee9

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ The standard import looks like:
5757
import { renderHook } from '@testing-library/react-hooks'
5858
```
5959

60-
> Note: The auto detection function may not work if tests are bundles before execution (e.g. to be
61-
> run in a browser)
60+
> Note: The auto detection function may not work if tests are being bundled (e.g. to be run in a
61+
> browser)
6262
6363
### Act
6464

src/__tests__/defaultRenderer.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('default renderer', () => {
3434
})
3535

3636
const expectedMessage =
37-
"Could not auto-detect a React renderer. Are you sure you've installed one of the following\n - react-dom\n - react-test-renderer"
37+
"Could not auto-detect a React renderer. Are you sure you've installed one of the following:\n - react-dom\n - react-test-renderer\nIf you are using a bundler, please update you imports to use a specific renderer. For instructions see: https://react-hooks-testing-library.com/installation#being-specific"
3838

3939
expect(() => require('..')).toThrowError(new Error(expectedMessage))
4040
})

src/pure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function getRenderer() {
2727
.join('\n')
2828

2929
throw new Error(
30-
`Could not auto-detect a React renderer. Are you sure you've installed one of the following\n${options}`
30+
`Could not auto-detect a React renderer. Are you sure you've installed one of the following:\n${options}\nIf you are using a bundler, please update you imports to use a specific renderer. For instructions see: https://react-hooks-testing-library.com/installation#being-specific`
3131
)
3232
}
3333
}

0 commit comments

Comments
 (0)