Skip to content

async-storage-mock.js cannot be compiled by Jest #116

Closed
@thomasarogers

Description

@thomasarogers

Jest hits 'Unexpected token identifier' when mocking react-native-community/react-native-async-storage following the docs on Github:
https://github.com/react-native-community/react-native-async-storage/blob/master/docs/Jest-integration.md

image

I have tried using the following babel.config.js with no luck

image

The following package.json dev dependencies:
image

Expected behavior

Jest should compile source and run tests successfully

Repro steps

Write Jest test with react-native-community/react-native-async-storage as a dependency then follow doc above to Mock react-native-community/react-native-async-storage with Jest

Environment

"@react-native-community/async-storage": "1.4"
info
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Memory: 17.23 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.15.0 - ~/.nvm/v8.15.0/bin/node
npm: 6.4.1 - ~/.nvm/v8.15.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 16, 19, 21, 22, 23
Build Tools: 21.1.2, 22.0.0, 23.0.2, 25.0.2, 27.0.3
System Images: android-21 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
npmGlobalPackages:
react-native-cli: 2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions