Skip to content
Open
Show file tree
Hide file tree
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
24 changes: 24 additions & 0 deletions __mocks__/moti.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Mock for moti to reduce memory usage in tests
const React = require("react")
const { View } = require("react-native")

module.exports = {
__esModule: true,
MotiView: View,
View: View,
AnimatePresence: ({ children }) => React.createElement(React.Fragment, null, children),
motify: (Component) => () => Component,
useDynamicAnimation: () => ({
current: {
height: 0,
},
start: jest.fn(),
stop: jest.fn(),
animateTo: jest.fn(),
animateToEnd: jest.fn(),
animateToStart: jest.fn(),
animateToValue: jest.fn(),
animateToEndValue: jest.fn(),
animateToStartValue: jest.fn(),
}),
}
7 changes: 7 additions & 0 deletions __mocks__/moti/interactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Mock for moti/interactions to reduce memory usage in tests
const { Pressable } = require("react-native")

module.exports = {
__esModule: true,
MotiPressable: Pressable,
}
4 changes: 4 additions & 0 deletions alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const jestModuleNameMap = list.reduce((acc, name) => {
}, {})
jestModuleNameMap["^images/(.*)"] = "<rootDir>/images/$1"

// Mock moti to reduce memory usage - catches both top-level and nested node_modules
jestModuleNameMap["^moti$"] = "<rootDir>/__mocks__/moti.js"
jestModuleNameMap["^moti/(.*)$"] = "<rootDir>/__mocks__/moti/$1.js"

module.exports = {
babelModuleResolverAlias,
jestModuleNameMap,
Expand Down