Closed jaybeeuu closed 4 years ago
It's deliberate - see fetch-mock docs here: http://www.wheresrhys.co.uk/fetch-mock/#usagerequirements
I will copy those docs to fetch-mock-jest's readme though
Ahh right. I 'm with you. Thanks for pointing out the docs. Should fetch-mock-jest declare node-fetch as a peerDependency in that case?
If i install as it stands without also installing node-fetch the first you know about it is a runtime error but If i monkey patch the package.json to add node-fetch as a peerdependency then i at least get a warning at install time.
fetch-mock already declares it as a peer dependency - do you not get any warnings when installing? I would've thought that peer dependency warnings get bubbled up to the end user no matter how deep the dependency, but have never actually checked
Hmm.. intuitively that would make sense. It might be a pnpm thing. I'll see what happens in a repro package with yarn & npm.
I got an error copied below while trying to use
v1.3.0
this library. It turns out thatnode-fetch
is currently only adevDependency
inpackage.json
. I'm usingpnpm
and it's strictness meantnode-fetch
wasn't available whenfetch-mock
(which has it as a peer dependency) required it. Moving the reference intodependencies
infetch-mock-jest
fixes the issue (I have verified (and worked around) that with apnpmfile.js
entry) and I thought you might like a quick PR. :)Many thanks for the library!