diff --git a/package.json b/package.json index af29f887da20..211a88e4b9ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-reanimated", - "version": "2.9.1-wp-2", + "version": "2.9.1-wp-3", "description": "More powerful alternative to Animated library for React Native.", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", diff --git a/react-native-reanimated-2.9.1-wp-2.tgz b/react-native-reanimated-2.9.1-wp-2.tgz deleted file mode 100644 index 760cc2975eff..000000000000 Binary files a/react-native-reanimated-2.9.1-wp-2.tgz and /dev/null differ diff --git a/react-native-reanimated-2.9.1-wp-3.tgz b/react-native-reanimated-2.9.1-wp-3.tgz new file mode 100644 index 000000000000..44d389e38dea Binary files /dev/null and b/react-native-reanimated-2.9.1-wp-3.tgz differ diff --git a/src/reanimated2/jestUtils.ts b/src/reanimated2/jestUtils.ts index 16df51409cea..e1aad6c0667c 100644 --- a/src/reanimated2/jestUtils.ts +++ b/src/reanimated2/jestUtils.ts @@ -188,7 +188,23 @@ export const advanceAnimationByFrame = (count) => { }; export const setUpTests = (userConfig = {}) => { - const expect = require('expect'); + let expect = global.expect; + if (expect === undefined) { + const expectModule = require('expect'); + expect = expectModule; + // Starting from Jest 28, "expect" package uses named exports instead of default export. + // So, requiring "expect" package doesn't give direct access to "expect" function anymore. + // It gives access to the module object instead. + // We use this info to detect if the project uses Jest 28 or higher. + if (typeof expect === 'object') { + const jestGlobals = require('@jest/globals'); + expect = jestGlobals.expect; + } + if (expect === undefined || expect.extend === undefined) { + expect = expectModule.default; + } + } + require('setimmediate'); frameTime = Math.round(1000 / config.fps);