axelnormand / react-native-typescript-wallaby-jest

skeleton project for create react native app and typescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with. jest

mickadoua opened this issue · comments

commented

Hello, thanks for this repo,
i. have an. issue when i run wallaby, and yarn jest

here the description

$ /Users/macbookpro/code/test/wallabytest/react-native-typescript-wallaby-jest/node_modules/.bin/jest
 FAIL  src/app/App/App.test.tsx
  ● Test suite failed to run

    /Users/macbookpro/code/test/wallabytest/react-native-typescript-wallaby-jest/node_modules/react-native/jest/setup.js: babel-plugin-jest-hoist: The module factory of `jest.mock()` is not allowed to reference any out-of-scope variables.
    Invalid variable access: console
    Whitelisted objects: Array, ArrayBuffer, Boolean, DataView, Date, Error, EvalError, Float32Array, Float64Array, Function, Generator, GeneratorFunction, Infinity, Int16Array, Int32Array, Int8Array, InternalError, Intl, JSON, Map, Math, NaN, Number, Object, Promise, Proxy, RangeError, ReferenceError, Reflect, RegExp, Set, String, Symbol, SyntaxError, TypeError, URIError, Uint16Array, Uint32Array, Uint8Array, Uint8ClampedArray, WeakMap, WeakSet, arguments, expect, jest, require, undefined, global, clearInterval, clearTimeout, setInterval, setTimeout, queueMicrotask, clearImmediate, setImmediate.
    Note: This is a precaution to guard against uninitialized mock variables. If it is ensured that the mock is required lazily, variable names prefixed with `mock` are permitted.
      
      at invariant (node_modules/babel-plugin-jest-hoist/build/index.js:12:11)

what can i. do to fix that ?

Thank you

Hi!
Glad you found this repo useful.
It's been a while (2 years maybe) since i've used this repo which in react native land is an age :)

A quick google and this issue suggests upgrading jest and jest-expo in package.json: facebook/react-native#19120

Let me check this repo out again and have a go.
In fact bumping loads of pacakges in package.json is probably worth it as they're all a bit old now