GithubHelp home page GithubHelp logo

Comments (6)

doniyor2109 avatar doniyor2109 commented on July 18, 2024 2

+1

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on July 18, 2024

Looking at that stack trace, it probably is a react-native-mock bug. However it's very difficult to tell what the issue is with just that stack trace. Can you try and reproduce it more clearly with an example, or provide a stack trace

from react-native-mock.

miguelc1221 avatar miguelc1221 commented on July 18, 2024

I'll try to reproduce in the meantime here is some more info. The above is what I keep getting when I try to run jest, so currently can run any tests.

What led me to use react-native-mock was the fact that I couldn't mock NativeEventEmitter which we are using.

dependencies

  "dependencies": {
    "babel-plugin-transform-decorators-legacy": "1.3.4",
    "bugsnag-react-native": "2.2.0",
    "class-autobind": "^0.1.4",
    "color": "0.11.3",
    "lodash": "4.15.0",
    "moment": "2.17.1",
    "react": "15.4.2",
    "react-native": "0.42.3",
    "react-native-calendar": "0.10.0",
    "react-native-extended-stylesheet": "0.3.0",
    "react-native-fs": "2.1.0-rc.1",
    "react-native-keyboard-aware-scroll-view": "0.2.3",
    "react-native-material-kit": "0.4.1",
    "react-native-sensitive-info": "3.0.2",
    "react-native-snap-carousel": "1.2.0",
    "react-native-svg": "5.1.5",
    "react-native-vector-icons": "2.1.0",
    "react-redux": "4.4.5",
    "redux": "3.6.0",
    "redux-async-action": "0.0.4",
    "redux-thunk": "2.1.0",
    "victory-native": "0.7.0"
  },
  "devDependencies": {
    "babel-eslint": "6.1.2",
    "babel-jest": "20.0.3",
    "enzyme": "2.8.2",
    "enzyme-to-json": "1.5.1",
    "eslint": "3.7.1",
    "eslint-config-airbnb": "10.0.1",
    "eslint-plugin-import": "1.16.0",
    "eslint-plugin-jsx-a11y": "2.2.3",
    "eslint-plugin-react": "6.4.1",
    "gradle-to-js": "0.2.5",
    "husky": "0.11.9",
    "jest": "20.0.4",
    "localenv": "0.2.2",
    "react-addons-test-utils": "15.4.2",
    "react-dom": "15.4.4",
    "react-test-renderer": "15.4.2",
    "redux-mock-store": "1.2.3",
    "request": "2.81.0",
    "react-native-mock": "0.3.1"
  }

Jest config

"jest": {
    "preset": "react-native",
    "verbose": true,
    "setupFiles": ["./jestsetup.js"],
    "snapshotSerializers": [
      "enzyme-to-json/serializer"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|bugsnag-react-native)/"
    ]
  },

jestSetup.js

require('react-native-mock/mock');

jest.mock('NativeModules', () => ({
  Environment: {
    BUGSNAG_API_KEY: 'ApiKey',
  },
}));

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on July 18, 2024

Hmm, interesting. I'd never considered people wanting to use react-native-mock with jest, but i guess it should work. But yes please try and narrow down exactly why it happens. It's possible it's some conflicting between react-native-mock and jest's builtin mock

from react-native-mock.

skathayat avatar skathayat commented on July 18, 2024

@miguelc1221 I am also experiencing the same issue. Have you found a solution to this?

from react-native-mock.

keithmattix avatar keithmattix commented on July 18, 2024

I get this because KeyboardManager is not included in the mocked native modules

from react-native-mock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.