Open hbroer opened 4 years ago
If I'm understanding this correctly... If this is being caused by node-fetch/blob/v2.6.1/package.json#L5
not having a .js
extension, I think this issue should be filed in node-fetch
instead to report the accidental breaking change.
2.6.2 now has extension in the main file
Hi,
i have some problems with
jest-fetch-mock
from the3.0.x
version range. It is not a problem with this package directly, it is caused by a dependency of a dependency of this package. When I update I get this Error:If I downgrade
jest-fetch-mock
back to 2.1.2 then it works again. I am using this package together with typescript, jest, ts-jest, babel-jest. Another workaround can be found at the end of this Issue.Environment
package.json
(only unit test relevant dependencies)tsconfig.json
jest.config.js
(part of it).babelrc
This version and its dependencies work:
jest-fetch-mock
2.1.2cross-fetch
^2.2.3 (results in 2.2.3)node-fetch
2.1.2package.json
ofnode-fetch
2.1.2This version fails:
jest-fetch-mock
3.0.3cross-fetch
^3.0.4node-fetch
2.6.0package.json
ofnode-fetch
2.6.0This is the problem AFAIK. I had the same problem with a dependency of another dependency while compiling with Webpack if it has a module with the
mjs
extension.The maintainers of
node-fetch
seems to found the problem or fixed it by accident in the @next version my setting module to a file with a js extension:package.json
ofnode-fetch
@nextChanging the dependency of
cross-fetch
tonode-fetch@next
then it works again. (aside of the Fact that it wants absolute urls so fetch("some-file.json") will not work. If that got fixed the tests run again)Workaround
I will open this issue nevertheless because it might help someone find a solution for this or a similar problem. I needed a while... :D