Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn test does not work in native #9

Open
Smtih opened this issue Feb 8, 2018 · 2 comments
Open

Yarn test does not work in native #9

Smtih opened this issue Feb 8, 2018 · 2 comments

Comments

@Smtih
Copy link

Smtih commented Feb 8, 2018

So I've been using this as the basis for a project using cra and crna.

Using the workspace_example provided running yarn test on the native project doesn't work (pretty obvious as it sitl points to ./node_modules/jest/.bin/jest.js which is now in the parent directory.

pointing to the jest file in the parent directory doesn't fix the issue as jest-expo preset is still using the native directory as it's root to find other modules.

Next level of fixing is to change the rootDir in jest. in the end I had to add the following lines to the package.json jest config.

  "jest": {
    "preset": "jest-expo",
    "rootDir": "..",
    "roots": [
      "<rootDir>/native",
      "<rootDir>/node_modules"
    ]
  },

the roots are needed such that it doesn't try and run tests in all folders from the workspace but can still find node modules, however it then can't interpret es6 things anymore. This is where I'm stuck.

@Smtih Smtih changed the title Yarn test does not work Yarn test does not work in native Feb 8, 2018
@dariocravero
Copy link

Does #8 sort it out for you?

@kimak
Copy link

kimak commented Apr 26, 2018

@dariocravero #8 doesn't make it work

I made a PR to fix web & native tests: #15
The main "tricks" was to move the native/.babelrc to the root folder (need documentation for that) + update the jest version on native side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants