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.
Does this help? https://github.com/facebook/jest/issues/3044
@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 :+1:
Glad it helped! 🙂
Most helpful comment
Does this help? https://github.com/facebook/jest/issues/3044