-
-
Notifications
You must be signed in to change notification settings - Fork 917
Closed
Labels
invalidThis doesn't seem rightThis doesn't seem right
Description
Version
v5
Reanimated Version
v3
Gesture Handler Version
v2
Platforms
Web
What happened?
After upgrading to @gorhom/bottom-sheet v5.1.6, running jest fails with the following error:
SyntaxError: Unexpected token '<'
This occurs because the mock.js file introduced in PR #2265 now includes JSX, which Jest cannot parse unless explicitly configured to transform the module using Babel.
This is a breaking change for apps that:
use Jest without transforming node_modules (which is default behavior), and rely on the mock working out of the box, as it did prior to v5.1.6.
📌 The root issue is the JSX syntax like:
<Content data={this.data} />
inside a non-transpiled .js file.
Reproduction steps
-
Install @gorhom/bottom-sheet v5.1.6
-
Create a test file like:
import { render } from '@testing-library/react-native';
import { BottomSheetModal } from '@gorhom/bottom-sheet';
test('renders modal', () => {
render(<BottomSheetModal />);
});
- Run jest
Expected: ✅ Test passes or mock works out of the box.
Actual: ❌ Jest fails with:
/node_modules/@gorhom/bottom-sheet/mock.js:54
<Content data={this.data} />
^
SyntaxError: Unexpected token '<'
Metadata
Metadata
Assignees
Labels
invalidThis doesn't seem rightThis doesn't seem right