Skip to content

Commit 65f5680

Browse files
authored
[babel-preset-expo] Fix js tests after upgrading to reanimated v4 (expo#38431)
1 parent f6336bc commit 65f5680

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

packages/babel-preset-expo/src/__tests__/hermes-bytecode.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ function getCaller(props: Record<string, string | boolean>): babel.TransformCall
1010
jest.mock('../common.ts', () => ({
1111
...jest.requireActual('../common.ts'),
1212
hasModule: jest.fn((moduleId) => {
13-
if (['react-native-reanimated', 'expo-router', '@expo/vector-icons'].includes(moduleId)) {
13+
if (
14+
[
15+
'react-native-worklets',
16+
'react-native-reanimated',
17+
'expo-router',
18+
'@expo/vector-icons',
19+
].includes(moduleId)
20+
) {
1421
return true;
1522
}
1623
return false;

packages/babel-preset-expo/src/__tests__/index.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ function getCaller(props: Record<string, string | boolean>): babel.TransformCall
1111
jest.mock('../common.ts', () => ({
1212
...jest.requireActual('../common.ts'),
1313
hasModule: jest.fn((moduleId) => {
14-
if (['react-native-reanimated', 'expo-router', '@expo/vector-icons'].includes(moduleId)) {
14+
if (
15+
[
16+
'react-native-worklets',
17+
'react-native-reanimated',
18+
'expo-router',
19+
'@expo/vector-icons',
20+
].includes(moduleId)
21+
) {
1522
return true;
1623
}
1724
return false;
@@ -245,7 +252,7 @@ export * as default from './Animated';
245252
});
246253

247254
it(`supports disabling reanimated`, () => {
248-
expect(require.resolve('react-native-reanimated/plugin')).toBeDefined();
255+
expect(require.resolve('react-native-worklets/plugin')).toBeDefined();
249256

250257
const samplesPath = path.resolve(__dirname, 'samples/worklet.js');
251258

@@ -263,7 +270,7 @@ export * as default from './Animated';
263270
});
264271

265272
it(`supports reanimated worklets`, () => {
266-
expect(require.resolve('react-native-reanimated/plugin')).toBeDefined();
273+
expect(require.resolve('react-native-worklets/plugin')).toBeDefined();
267274

268275
const samplesPath = path.resolve(__dirname, 'samples/worklet.js');
269276

@@ -290,7 +297,7 @@ export * as default from './Animated';
290297
babel.transformFileSync(samplesPath, {
291298
...options,
292299
// Test that duplicate plugins make no difference
293-
plugins: [require.resolve('react-native-reanimated/plugin')],
300+
plugins: [require.resolve('react-native-worklets/plugin')],
294301
})!.code
295302
)
296303
).toBe(code);

0 commit comments

Comments
 (0)