Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,31 @@
import { VirtualDetector } from '../v3/detectors/VirtualDetector/VirtualDetector';

jest.mock('react-native-worklets', () =>
require('react-native-worklets/src/mock')

Check warning on line 15 in packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx

View workflow job for this annotation

GitHub Actions / check

Unsafe return of an `any` typed value
);

// Reanimated 4.6.0 throws on import under Jest (`setCSSEventHandler` is not
// available in JSReanimated), which reanimatedWrapper silently turns into
// `Reanimated = undefined`. Mock the wrapper so gestures with worklet
// callbacks still take the Reanimated detector path these tests rely on.
//
// TODO: Remove after fixed in Reanimated
jest.mock('../handlers/gestures/reanimatedWrapper', () => ({
Comment on lines +18 to +24
Reanimated: {
useHandler: jest.fn(() => ({
doDependenciesDiffer: false,
context: { lastUpdateEvent: undefined },
})),
useEvent: jest.fn(() => jest.fn()),
useComposedEventHandler: jest.fn(() => jest.fn()),
isSharedValue: (value: unknown): boolean =>
value !== null && typeof value === 'object' && 'value' in value,
useSharedValue: <T,>(value: T) => ({ value }),

Check warning on line 34 in packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx

View workflow job for this annotation

GitHub Actions / check

If your function doesn't call any Hooks, avoid the 'use' prefix. Instead, write it as a regular function without the 'use' prefix

Check warning on line 34 in packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx

View workflow job for this annotation

GitHub Actions / check

If your function doesn't call any Hooks, avoid the 'use' prefix. Instead, write it as a regular function without the 'use' prefix
setGestureState: jest.fn(),
},
Worklets: undefined,
}));

beforeEach(() => cleanup());
jest.mock('react-native/Libraries/ReactNative/RendererProxy', () => ({
findNodeHandle: jest.fn(),
Expand Down
Loading