react-native-animatable icon indicating copy to clipboard operation
react-native-animatable copied to clipboard

Error with named imports when running jest snapshot tests

Open jayshah123 opened this issue 5 years ago • 1 comments

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');

jayshah123 avatar May 16 '20 18:05 jayshah123

Hi, have you found a fix?

DoneDeal0 avatar Oct 21 '21 15:10 DoneDeal0