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

testPathDirs does not work with React Native, but testRegex does #2670

Closed
milesj opened this issue Jan 22, 2017 · 4 comments
Closed

testPathDirs does not work with React Native, but testRegex does #2670

milesj opened this issue Jan 22, 2017 · 4 comments

Comments

@milesj
Copy link

milesj commented Jan 22, 2017

Do you want to request a feature or report a bug?

Bug.

What is the current behavior?

I'm trying to add RN support to my Aesthetic project, but am running into a few issues. I have updated my jest.json with "preset": "react-native", which works, but it seems like "testPathDirs": ["./tests"], does not work as it throws these errors:

 FAIL  tests/createStyler.test.js
  ● Test suite failed to run

    Cannot find module 'setupDevtools' from 'setup.js'
      
      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
      at Object.<anonymous> (node_modules/react-native/jest/setup.js:23:1)

If I replace testPathDirs with "testRegex": "./tests/.*\\.test\\.js$",, the tests now run. I've tried all the examples I've seen to "fix this", but nothing has worked. Using a regex pattern seems hacky.

PR here: https://github.com/milesj/aesthetic/pull/4/files

What is the expected behavior?

Tests run using testPathDirs.

@cpojer
Copy link
Member

cpojer commented Jan 23, 2017

Don't use testPathDirs for this, it actually means "roots". We should eventually rename this option.

@milesj
Copy link
Author

milesj commented Jan 24, 2017

Is using testRegex going to be the standard way? Or should it be a combination of both options?

@cpojer
Copy link
Member

cpojer commented Jan 24, 2017

testRegex for now, yes. We will also add a glob option soon. #2359

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants