-
Notifications
You must be signed in to change notification settings - Fork 164
docs: add Jest troubleshooting note for @react-three/cannon #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -590,6 +590,20 @@ interface RaycastVehicleProps { | |||||||||||||
| - NaiveBroadphase is as simple as it gets. It considers every body to be a potential collider with every other body. This results in the maximum number of narrowphase checks. | ||||||||||||||
| - SAPBroadphase sorts bodies along an axis and then moves down that list finding pairs by looking at body size and position of the next bodies. Control what axis to sort along by setting the axisIndex property. | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| ### Testing with Jest | ||||||||||||||
|
|
||||||||||||||
| If Jest reports that it cannot find `@react-three/cannon`, the problem is usually related to the test environment rather than the runtime package itself. | ||||||||||||||
|
|
||||||||||||||
| Because `@react-three/cannon` is commonly used in modern React/ESM setups, some Jest configurations may need additional module resolution or transform settings. If you are unit testing components that import physics hooks, consider one of these approaches: | ||||||||||||||
|
|
||||||||||||||
| - configure Jest to handle ESM dependencies used by your React/Three stack | ||||||||||||||
| - mock `@react-three/cannon` in tests that do not need real physics behavior | ||||||||||||||
| - keep physics integration in higher-level tests and isolate pure logic into testable helper functions | ||||||||||||||
|
Comment on lines
+600
to
+602
|
||||||||||||||
| - configure Jest to handle ESM dependencies used by your React/Three stack | |
| - mock `@react-three/cannon` in tests that do not need real physics behavior | |
| - keep physics integration in higher-level tests and isolate pure logic into testable helper functions | |
| - Configure Jest to handle ESM dependencies used by your React/Three stack | |
| - Mock `@react-three/cannon` in tests that do not need real physics behavior | |
| - Keep physics integration in higher-level tests and isolate pure logic into testable helper functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading level for "Testing with Jest" breaks the FAQ structure: it’s currently an H3 (###) inside the "### FAQ" section, while the surrounding FAQ entries (e.g., "Broadphases", "Types") are H4 (####). As written, this makes "Types" appear as a subsection of "Testing with Jest" instead of a sibling FAQ item. Consider changing this heading to H4 (####) to keep the hierarchy consistent.