Coder Social home page Coder Social logo

Usage with mocha about bugsnag-react-native HOT 5 CLOSED

bugsnag avatar bugsnag commented on July 30, 2024
Usage with mocha

from bugsnag-react-native.

Comments (5)

john-farmer-candor avatar john-farmer-candor commented on July 30, 2024 2

I also ran into this problem with CircleCI. It's expecting es5 source and gets an error on the es6 import statement in node_modules/bugsnag-react-native/index.js.

I'll try working around it by testing for the circleci environment variables and not importing bugsnag for now.

from bugsnag-react-native.

kattrali avatar kattrali commented on July 30, 2024

Thanks for the report, @henrikra. Can you share your .babelrc? Maybe there is a configuration option which would help here.

from bugsnag-react-native.

henrikra avatar henrikra commented on July 30, 2024

My .babelrc has basic conf: {"presets": ["react-native"]}
Another way we solved this was by ignoring bugsnag-react-native import when testing. Adding custom module loader to setup.js:

require('react-native-mock/mock');
const m = require('module');

global.__DEV__ = true;
const originalLoader = m._load;

m._load = function hookedLoader(request, parent, isMain) {
  if (request === 'bugsnag-react-native') {
    return {};
  }
  return originalLoader(request, parent, isMain);
};

This will return empty object when bugsnag-react-native is being imported otherwise it loads modules as normal :)

from bugsnag-react-native.

NicolasBonduel avatar NicolasBonduel commented on July 30, 2024

Hello guys, I'm having the same issue with Jest. I have the same .babelrc file as @henrikra
We manually mocked bugsnag so we don't get the issue anymore:

let bugsnag = {
  leaveBreadcrumb: (message, metadata) => {
    console.log({message, ...metadata});
  }
};

if (envData.environment !== 'DEV') {
  const bugsnagRN = require("bugsnag-react-native");
  const configuration = new bugsnagRN.Configuration("[...]");
  configuration.releaseStage = envData.environment;
  bugsnag = new bugsnagRN.Client(configuration);
}

@wordofchristian had the same issue here: #10

from bugsnag-react-native.

llaine avatar llaine commented on July 30, 2024

Experiencing the same issue with sdk v2.2.3

from bugsnag-react-native.

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.