oblador / react-native-animatable

Standard set of easy to use animations and declarative transitions for React Native
MIT License
9.81k stars 702 forks source link

Error with named imports when running jest snapshot tests #314

Open jayshah123 opened 4 years ago

jayshah123 commented 4 years ago

When using a simple snapshot test with import done as below, jest test fail.

    TypeError: Invalid value used as weak map key
        at WeakMap.set (<anonymous>)

      3 | import Circles from "react-native-android-circles";
      4 | import PropTypes from "prop-types";
    > 5 | import * as Animatable from "react-native-animatable";
        |                  ^
      6 | import { Image, StyleSheet, Text, View } from "react-native";
      7 | 
      8 | export default class ApiLoader extends Component {

      at _interopRequireWildcard (node_modules/@babel/runtime/helpers/interopRequireWildcard.js:47:11)
      at Object.<anonymous> (src/ui/widget/ApiLoader.js:5:18)
      at Object.<anonymous> (src/ui/widget/__tests__/ApiLoader.test.js:7:21)

version: 1.3.0 RN version: 61.5 jest version: 24.9.0 babel core/runtime version: 7.6.2

This library is already added in jest config section of transformIgnorePatterns but this issue still occurs.

The issue does not occur if used in following way:

const Animatable = require('react-native-animatable');
DoneDeal0 commented 2 years ago

Hi, have you found a fix?