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
15 changes: 15 additions & 0 deletions knip.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ const config: KnipConfig = {
// The babel presets are referenced as strings in tsdown.config.ts.
ignoreDependencies: ['babel-preset-solid', '@babel/preset-typescript'],
},
'packages/native': {
// The Expo shell: `userInterfaceStyle` is honored from the manifest on
// iOS; the Android half would need the expo-system-ui native module,
// which a stories harness has no use for. `@expo/vector-icons` is a
// moduleNameMapper target inside jest-expo's own preset, not ours.
ignoreDependencies: ['expo-system-ui', '@expo/vector-icons'],
// babel-preset-expo ships inside `expo`; babel-jest is jest-expo's
// transform, resolved from the preset. Neither is ours to list.
ignoreUnresolved: ['babel-preset-expo', 'babel-jest'],
},
// The on-device Storybook reaches the stories through the generated,
// gitignored storybook.requires.ts (see .rnstorybook/index.ts).
'packages/native/*': {
entry: ['stories/*.stories.tsx'],
},
},
}

Expand Down
1 change: 1 addition & 0 deletions packages/native/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"orientation": "portrait",
"userInterfaceStyle": "light",
"newArchEnabled": true,
"updates": { "enabled": false },
"ios": { "supportsTablet": true, "bundleIdentifier": "dev.dunky.ui" },
"android": { "package": "dev.dunky.ui" }
}
Expand Down
12 changes: 12 additions & 0 deletions packages/native/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@ const transformIgnorePatterns = expoPreset.transformIgnorePatterns.map(pattern =
pattern.replace('/node_modules/(?!(.pnpm|', '/node_modules/(?!(.pnpm|@dunky\\.dev|'),
)

// jest-expo turns the nearest tsconfig's `paths` into moduleNameMapper entries
// relative to `<rootDir>` — which for this package points nowhere, and which
// tsconfig is "nearest" depends on the cwd (the repo root's has the workspace
// paths, this package's has none). The @dunky.dev packages resolve through the
// workspace links and the resolver below instead, so drop the mapping.
const moduleNameMapper = Object.fromEntries(
Object.entries(expoPreset.moduleNameMapper ?? {}).filter(
([pattern]) => !pattern.startsWith('^@dunky\\.dev/'),
),
)

module.exports = {
...expoPreset,
rootDir: '.',
testMatch: ['<rootDir>/*/tests/**/*.test.@(ts|tsx)'],
moduleNameMapper,
// Establish React 19's act environment for the whole run (appended to
// jest-expo's own setup, not replacing it).
setupFiles: [...(expoPreset.setupFiles ?? []), '<rootDir>/jest-setup.cjs'],
Expand Down
3 changes: 0 additions & 3 deletions packages/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@
"@react-native/jest-preset": "^0.86.2",
"@storybook/react-native": "^10.5.0",
"@types/react": "^19.2.17",
"expo": "~57.0.11",
"jest": "^29.7.0",
"jest-expo": "~57.0.3",
"react": "19.2.3",
"react-native": "^0.86.2",
"react-native-gesture-handler": "~2.32.0",
"react-native-reanimated": "4.5.1",
"react-native-safe-area-context": "~5.7.0",
Expand Down
Loading