Skip to content

Commit a3ead1c

Browse files
committed
fix: jest failure
1 parent d8830ba commit a3ead1c

File tree

7 files changed

+17
-11
lines changed

7 files changed

+17
-11
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import 'react-native-gesture-handler/jestSetup';
22

3-
// @ts-ignore
4-
global.window.navigator = {};
3+
jest.doMock('react-native/Libraries/NativeComponent/ViewConfigIgnore', () => ({
4+
ConditionallyIgnoredEventHandlers: () => undefined,
5+
DynamicallyInjectedByGestureHandler: () => ({}),
6+
isIgnored: () => true,
7+
}));

packages/react-native/jest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/** @type {import('jest').Config} */
22
const config = {
33
preset: 'jest-expo',
4+
setupFiles: ['<rootDir>/setup.js'],
5+
46
transformIgnorePatterns: [
57
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg|storybook/.*|@storybook/.*|uuid)',
68
],

packages/react-native/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
"jotai": "^2.6.2",
7272
"react": "19.1.0",
7373
"react-native": "0.81.0",
74-
"react-test-renderer": "^19.1.0",
7574
"storybook": "^9.1.2",
7675
"tsup": "^8.5.0",
77-
"typescript": "~5.9.2"
76+
"typescript": "~5.9.2",
77+
"universal-test-renderer": "^0.6.0"
7878
},
7979
"peerDependencies": {
8080
"@gorhom/bottom-sheet": ">=4",
@@ -100,7 +100,7 @@
100100
}
101101
},
102102
"engines": {
103-
"node": ">=8.0.0"
103+
"node": ">=20"
104104
},
105105
"publishConfig": {
106106
"access": "public"

packages/react-native/scripts/generate.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ const { generate } = require('./generate');
44
let pathMock;
55
let fileContentMock;
66

7-
global.window.navigator = {};
8-
97
jest.mock('fs', () => ({
108
...jest.requireActual('fs'),
119
writeFileSync: (filePath, fileContent, opts) => {

packages/react-native/setup.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// eslint-disable-next-line no-undef
2+
jest.doMock('react-native/Libraries/NativeComponent/ViewConfigIgnore', () => ({
3+
ConditionallyIgnoredEventHandlers: () => undefined,
4+
DynamicallyInjectedByGestureHandler: () => ({}),
5+
isIgnored: () => true,
6+
}));

packages/react-native/src/Start.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { prepareStories } from './Start';
22

3-
// @ts-ignore
4-
global.window.navigator = {};
5-
63
describe('prepareStories', () => {
74
test('prepares a standard CSF story file', () => {
85
const req = () => {

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7970,12 +7970,12 @@ __metadata:
79707970
react: "npm:19.1.0"
79717971
react-native: "npm:0.81.0"
79727972
react-native-url-polyfill: "npm:^2.0.0"
7973-
react-test-renderer: "npm:^19.1.0"
79747973
setimmediate: "npm:^1.0.5"
79757974
storybook: "npm:^9.1.2"
79767975
tsup: "npm:^8.5.0"
79777976
type-fest: "npm:~2.19"
79787977
typescript: "npm:~5.9.2"
7978+
universal-test-renderer: "npm:^0.6.0"
79797979
util: "npm:^0.12.4"
79807980
ws: "npm:^8.18.0"
79817981
peerDependencies:

0 commit comments

Comments
 (0)