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

jest-resolve fail to resolve json files #3252

Closed
stephenlautier opened this issue Apr 4, 2017 · 4 comments
Closed

jest-resolve fail to resolve json files #3252

stephenlautier opened this issue Apr 4, 2017 · 4 comments

Comments

@stephenlautier
Copy link

stephenlautier commented Apr 4, 2017

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

What is the current behavior?
Currently when there are any dependencies which require .json files, and not explicitly specifying the type .json (not sure if it matters), jest-resolve is throwing an error as following:

 FAIL  src\lint\lint-sass\lint-sass.spec.ts
  ● Test suite failed to run

    Cannot find module './data/all' from 'index.js'

      at Resolver.resolveModule (node_modules\jest-resolve\build\index.js:169:17)
      at Object.<anonymous> (node_modules\known-css-properties\index.js:1:111)

This is the library which throws the error
https://github.com/betit/known-css-properties/blob/master/index.js#L1 (and the import is from a json file), also was getting the same issue from normalize-package-data

I'm currently switching a library from using jasmine (also as a runner) to jest. This has happened in 2 libraries (dependency of a dependency)

What is the expected behavior?
I believe that such an import should work correctly since it works in node and also in jasmine runner.
personally i wouldn't use json files in the first place but that's another story :)

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

  • Jest: 19.0.2
  • Node: 7.8.0
  • NPM: 4.4.4
  • Windows 7
@thymikee
Copy link
Collaborator

thymikee commented Apr 4, 2017

Does this help? #3044

@stephenlautier
Copy link
Author

@thymikee precisely, that fixed it!

I had searched quite a bit and didn't find that :(
Not sure if it's documented anywhere but it took me quite some time to figure what was going wrong in the first place.

@thymikee many thanks, especially for the super fast reply 👍

@thymikee
Copy link
Collaborator

thymikee commented Apr 4, 2017

Glad it helped! 🙂

@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