-
Couldn't load subscription status.
- Fork 24.9k
Closed
jestjs/jest
#6505Labels
Description
- I have reviewed the documentation
- I have searched existing issues
- I am using the latest React Native version
Environment
My Environment is as below.
Scanning folders for symlinks in /Users/sirjmkitavi/Andela/playground/react-native/ball-animation/node_modules (25ms)
Environment:
OS: macOS High Sierra 10.13.2
Node: 10.0.0
Yarn: 1.6.0
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.3.2 => 16.3.2
react-native: ^0.55.3 => 0.55.3
Steps to Reproduce
-
Initialise
react-nativeapplication. Preferably usingreact-native-cliei.e
react-native init SampleProj -
Ensure you have atleast one test.
-
Run
yarn test
Expected Behavior
The expected behaviour is for the tests to run successfully. To either fail or pass.
Actual Behavior
All test suites fail throwing the error below
/Users/{user}/pulse/pulse-mobile-app/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
...
The error message continues to say
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, DTRACE_NET_SERVER_CONNECTION, DTRACE_NET_STREAM_END,
DTRACE_HTTP_SERVER_REQUEST, DTRACE_HTTP_SERVER_RESPONSE,
DTRACE_HTTP_CLIENT_REQUEST, DTRACE_HTTP_CLIENT_RESPONSE, global, process, Buffer,
clearImmediate, clearInterval, clearTimeout, setImmediate, setInterval, setTimeout.
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:14:11)
at newFn (node_modules/babel-traverse/lib/visitors.js:276:21)
at NodePath._call (node_modules/babel-traverse/lib/path/context.js:76:18)
at NodePath.call (node_modules/babel-traverse/lib/path/context.js:48:17)
at NodePath.visit (node_modules/babel-traverse/lib/path/context.js:105:12)
at TraversalContext.visitQueue (node_modules/babel-traverse/lib/context.js:150:16)
willemliu, tomaskazatel, thsowers, WildyDS, borisyankov and 21 more