Giter VIP home page Giter VIP logo

Comments (4)

mroswald avatar mroswald commented on August 14, 2024 1

in our mocha config we do --register a file that looks like this:

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

require('babel-core/register')({
    ignore: function(packageName) {
        if (packageName.match(/node_modules/)) {
            return !(packageName.match(/react-native-vector-icons/)
                || packageName.match(/react-native-animatable/)
            );
        }
        return false;
    }
});

[...]

from react-native-mock.

sibelius avatar sibelius commented on August 14, 2024

I'm receiving a flow error I guess

react-native-vector-icons/lib/create-icon-set.js:39
function createIconSet(glyphMap : Object, fontFamily : string, fontFile : string) : Function {
                                ^
SyntaxError: Unexpected token :

is there a workaround for this for now?

from react-native-mock.

sibelius avatar sibelius commented on August 14, 2024

I'm receiving this error when I try to run tests with react-native-router-flux

app/node_modules/babel-core/lib/transformation/file/index.js:591
      throw err;
      ^

SyntaxError: app/node_modules/react-native-router-flux/src/menu_burger.png: Unexpected character '�' (1:0)
> 1 | �PNG
    | ^
  2 | 
  3 | 

this is my testHelper.js file

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

require('babel-core/register')({
  ignore: function(packageName) {
    if (packageName.match(/node_modules/)) {
      return !(packageName.match(/react-native-vector-icons/)
        || packageName.match(/react-native-animatable/)
        || packageName.match(/react-native-router-flux/)
        || packageName.match(/react-native-tab-navigator/)
      );
    }
    return false;
  }
});

and this is my npm test script

"test": "node_modules/.bin/mocha --compilers js:babel-core/register --require testHelper.js **/__test__/*.js",

any workaround to handle this?

from react-native-mock.

RealOrangeOne avatar RealOrangeOne commented on August 14, 2024

@sibeliusseraphini Yes, this occurs when node tries to require an image as JS. See #11 for more discussions

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.